From 6a17e328e8634c64db8e1d103478bb32881c1afe Mon Sep 17 00:00:00 2001 From: Triplelexx Date: Wed, 22 Mar 2017 22:13:39 +0000 Subject: [PATCH 1/7] fix myVisibility typo --- scripts/system/tablet-users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/tablet-users.js b/scripts/system/tablet-users.js index 88ffa33a88..d5c381917e 100644 --- a/scripts/system/tablet-users.js +++ b/scripts/system/tablet-users.js @@ -30,7 +30,7 @@ } else { // default to friends if it can't be determined myVisibility = "friends"; - GlobalServices.findableBy = myVisibilty; + GlobalServices.findableBy = myVisibility; } var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); From d4353e1d1985294d4c52f7c4444455b301987298 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 23 Mar 2017 11:39:42 -0700 Subject: [PATCH 2/7] Fix warnings --- libraries/avatars/src/AvatarData.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 3c33451f02..dc806a4115 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -47,9 +47,6 @@ quint64 DEFAULT_FILTERED_LOG_EXPIRY = 2 * USECS_PER_SECOND; using namespace std; -const glm::vec3 DEFAULT_LOCAL_AABOX_CORNER(-0.5f); -const glm::vec3 DEFAULT_LOCAL_AABOX_SCALE(1.0f); - const QString AvatarData::FRAME_NAME = "com.highfidelity.recording.AvatarData"; static const int TRANSLATION_COMPRESSION_RADIX = 12; From 8116de7c145bd191088ca162fb85fcedf5b1898d Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 23 Mar 2017 13:45:13 -0700 Subject: [PATCH 3/7] Force thread linkage --- CMakeLists.txt | 2 ++ cmake/macros/SetupHifiPlugin.cmake | 1 + cmake/macros/SetupHifiProject.cmake | 1 + cmake/macros/SetupHifiTestCase.cmake | 1 + 4 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0703866ac6..aa2c353453 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ project(hifi) add_definitions(-DGLM_FORCE_RADIANS) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") +find_package( Threads ) + if (WIN32) add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS) diff --git a/cmake/macros/SetupHifiPlugin.cmake b/cmake/macros/SetupHifiPlugin.cmake index 0db91cb9e6..7e56ea3db2 100644 --- a/cmake/macros/SetupHifiPlugin.cmake +++ b/cmake/macros/SetupHifiPlugin.cmake @@ -9,6 +9,7 @@ macro(SETUP_HIFI_PLUGIN) set(${TARGET_NAME}_SHARED 1) setup_hifi_library(${ARGV}) add_dependencies(interface ${TARGET_NAME}) + target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Plugins") if (APPLE) diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 8695063556..8759c949f3 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -43,6 +43,7 @@ macro(SETUP_HIFI_PROJECT) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) endforeach() + target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) target_glm() diff --git a/cmake/macros/SetupHifiTestCase.cmake b/cmake/macros/SetupHifiTestCase.cmake index 38239d6e97..6c7d38e19c 100644 --- a/cmake/macros/SetupHifiTestCase.cmake +++ b/cmake/macros/SetupHifiTestCase.cmake @@ -108,6 +108,7 @@ macro(SETUP_HIFI_TESTCASE) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) endforeach() + target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "hidden/test-executables") From 5a5eb6e168397169facc6e71909b9ff350f007c1 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 23 Mar 2017 14:09:34 -0700 Subject: [PATCH 4/7] Still trying to fix build error --- tests/render-utils/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/render-utils/CMakeLists.txt b/tests/render-utils/CMakeLists.txt index e7e80f7726..5ec6a28b5c 100644 --- a/tests/render-utils/CMakeLists.txt +++ b/tests/render-utils/CMakeLists.txt @@ -7,5 +7,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") # link in the shared libraries link_hifi_libraries(render-utils gl gpu gpu-gl shared) +target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) package_libraries_for_deployment() From 82d502ae9f494f07c573d4798ac6a2fb50b82638 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 24 Mar 2017 13:35:37 -0700 Subject: [PATCH 5/7] Correctly initialize a file cache with the proper key --- libraries/networking/src/FileCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/FileCache.cpp b/libraries/networking/src/FileCache.cpp index f8a86903cb..0a859d511b 100644 --- a/libraries/networking/src/FileCache.cpp +++ b/libraries/networking/src/FileCache.cpp @@ -67,9 +67,9 @@ void FileCache::initialize() { // load persisted files foreach(QString filename, files) { - const Key key = filename.section('.', 0, 1).toStdString(); + const Key key = filename.section('.', 0, 0).toStdString(); const std::string filepath = dir.filePath(filename).toStdString(); - const size_t length = std::ifstream(filepath, std::ios::binary | std::ios::ate).tellg(); + const size_t length = QFileInfo(filepath.c_str()).size(); addFile(Metadata(key, length), filepath); } From f7de74109b022d0c5131281a23d1ee7d40441161 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 24 Mar 2017 15:10:26 -0700 Subject: [PATCH 6/7] Added jsdoc documentation for some of MyAvatar properties and methods --- interface/src/avatar/MyAvatar.h | 162 ++++++++++++++++++++++++++- interface/src/ui/overlays/Overlays.h | 2 +- tools/jsdoc/plugins/hifi.js | 9 +- 3 files changed, 164 insertions(+), 9 deletions(-) diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 5f812f1f99..9f93fa1bd2 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -46,6 +46,60 @@ Q_DECLARE_METATYPE(AudioListenerMode); class MyAvatar : public Avatar { Q_OBJECT + + /**jsdoc + * Your avatar is your in-world representation of you. The MyAvatar API is used to manipulate the avatar. + * For example, using the MyAvatar API you can customize the avatar's appearance, run custom avatar animations, + * change the avatar's position within the domain, or manage the avatar's collisions with other objects. + * NOTE: MyAvatar extends Avatar and AvatarData, see those namespace for more properties/methods. + * + * @namespace MyAvatar + * @augments Avatar + * @property shouldRenderLocally {bool} Set it to true if you would like to see MyAvatar in your local interface, + * and false if you would not like to see MyAvatar in your local interface. + * @property motorVelocity {Vec3} Can be used to move the avatar with this velocity. + * @property motorTimescale {float} Specifies how quickly the avatar should accelerate to meet the motorVelocity, + * smaller values will result in higher acceleration. + * @property motorReferenceFrame {string} Reference frame of the motorVelocity, must be one of the following: "avatar", "camera", "world" + * @property collisionSoundURL {string} Specifies the sound to play when the avatar experiences a collision. + * You can provide a mono or stereo 16-bit WAV file running at either 24 Khz or 48 Khz. + * The latter is downsampled by the audio mixer, so all audio effectively plays back at a 24 Khz sample rate. + * 48 Khz RAW files are also supported. + * @property audioListenerMode {number} When hearing spatialized audio this determines where the listener placed. + * Should be one of the following values: + * MyAvatar.audioListenerModeHead - the listener located at the avatar's head. + * MyAvatar.audioListenerModeCamera - the listener is relative to the camera. + * MyAvatar.audioListenerModeCustom - the listener is at a custom location specified by the MyAvatar.customListenPosition + * and MyAvatar.customListenOrientation properties. + * @property customListenPosition {Vec3} If MyAvatar.audioListenerMode == MyAvatar.audioListenerModeHead, then this determines the position + * of audio spatialization listener. + * @property customListenOreintation {Quat} If MyAvatar.audioListenerMode == MyAvatar.audioListenerModeHead, then this determines the orientation + * of the audio spatialization listener. + * @property audioListenerModeHead {number} READ-ONLY. When passed to MyAvatar.audioListenerMode, it will set the audio listener + * around the avatar's head. + * @property audioListenerModeCamera {number} READ-ONLY. When passed to MyAvatar.audioListenerMode, it will set the audio listener + * around the camera. + * @property audioListenerModeCustom {number} READ-ONLY. When passed to MyAvatar.audioListenerMode, it will set the audio listener + * around the value specified by MyAvatar.customListenPosition and MyAvatar.customListenOrientation. + * @property leftHandPosition {Vec3} READ-ONLY. The desired position of the left wrist in avatar space, determined by the hand controllers. + * Note: only valid if hand controllers are in use. + * @property rightHandPosition {Vec3} READ-ONLY. The desired position of the right wrist in avatar space, determined by the hand controllers. + * Note: only valid if hand controllers are in use. + * @property leftHandTipPosition {Vec3} READ-ONLY. A position 30 cm offset from MyAvatar.leftHandPosition + * @property rightHandTipPosition {Vec3} READ-ONLY. A position 30 cm offset from MyAvatar.rightHandPosition + * @property leftHandPose {Pose} READ-ONLY. Returns full pose (translation, orientation, velocity & angularVelocity) of the desired + * wrist position, determined by the hand controllers. + * @property rightHandPose {Pose} READ-ONLY. Returns full pose (translation, orientation, velocity & angularVelocity) of the desired + * wrist position, determined by the hand controllers. + * @property leftHandTipPose {Pose} READ-ONLY. Returns a pose offset 30 cm from MyAvatar.leftHandPose + * @property rightHandTipPose {Pose} READ-ONLY. Returns a pose offset 30 cm from MyAvatar.rightHandPose + * @property hmdLeanRecenterEnabled {bool} This can be used disable the hmd lean recenter behavior. This behavior is what causes your avatar + * to follow your HMD as you walk around the room, in room scale VR. Disabling this is useful if you desire to pin the avatar to a fixed location. + * @property characterControllerEnabled {bool} This can be used to disable collisions between the avatar and the world. + * @property useAdvancedMovementControls {bool} Stores the user preference only, does not change user mappings, this is done in the defaultScript + * "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js". + */ + Q_PROPERTY(bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally) Q_PROPERTY(glm::vec3 motorVelocity READ getScriptedMotorVelocity WRITE setScriptedMotorVelocity) Q_PROPERTY(float motorTimescale READ getScriptedMotorTimescale WRITE setScriptedMotorTimescale) @@ -106,7 +160,19 @@ public: void reset(bool andRecenter = false, bool andReload = true, bool andHead = true); Q_INVOKABLE void resetSensorsAndBody(); + + /**jsdoc + * Moves and orients the avatar, such that it is directly underneath the HMD, with toes pointed forward. + * @function MyAvatar.centerBody + */ Q_INVOKABLE void centerBody(); // thread-safe + + + /**jsdoc + * The internal inverse-kinematics system maintains a record of which joints are "locked". Sometimes it is useful to forget this history, to prevent + * contorted joints. + * @function MyAvatar.clearIKJointLimitHistory + */ Q_INVOKABLE void clearIKJointLimitHistory(); // thread-safe void update(float deltaTime); @@ -137,23 +203,109 @@ public: void setRealWorldFieldOfView(float realWorldFov) { _realWorldFieldOfView.set(realWorldFov); } + /**jsdoc + * The default position in world coordinates of the point directly between the avatar's eyes + * @function MyAvatar.getDefaultEyePosition + * @example This example gets the default eye position and prints it to the debug log. + * var defaultEyePosition = MyAvatar.getDefaultEyePosition(); + * print (JSON.stringify(defaultEyePosition)); + * @returns {Vec3} Position between the avatar's eyes. + */ Q_INVOKABLE glm::vec3 getDefaultEyePosition() const; float getRealWorldFieldOfView() { return _realWorldFieldOfView.get(); } - // Interrupt the current animation with a custom animation. + /**jsdoc + * The avatar animation system includes a set of default animations along with rules for how those animations are blended + * together with procedural data (such as look at vectors, hand sensors etc.). overrideAnimation() is used to completely + * override all motion from the default animation system (including inverse kinematics for hand and head controllers) and + * play a specified animation. To end this animation and restore the default animations, use MyAvatar.restoreAnimation. + * @function MyAvatar.overrideAnimation + * @example Play a clapping animation on your avatar for three seconds. + * // Clap your hands for 3 seconds then restore animation back to the avatar. + * var ANIM_URL = "https://s3.amazonaws.com/hifi-public/animations/ClapAnimations/ClapHands_Standing.fbx"; + * MyAvatar.overrideAnimation(ANIM_URL, 30, true, 0, 53); + * Script.setTimeout(function () { + * MyAvatar.restoreAnimation(); + * }, 3000); + * @param url {string} The URL to the animation file. Animation files need to be .FBX format, but only need to contain the avatar skeleton and animation data. + * @param fps {number} The frames per second (FPS) rate for the animation playback. 30 FPS is normal speed. + * @param loop {bool} Set to true if the animation should loop. + * @param firstFrame {number} The frame the animation should start at. + * @param lastFrame {number} The frame the animation should end at. + */ Q_INVOKABLE void overrideAnimation(const QString& url, float fps, bool loop, float firstFrame, float lastFrame); - // Stop the animation that was started with overrideAnimation and go back to the standard animation. + /**jsdoc + * The avatar animation system includes a set of default animations along with rules for how those animations are blended together with + * procedural data (such as look at vectors, hand sensors etc.). Playing your own custom animations will override the default animations. + * restoreAnimation() is used to restore all motion from the default animation system including inverse kinematics for hand and head + * controllers. If you aren't currently playing an override animation, this function will have no effect. + * @function MyAvatar.restoreAnimation + * @example Play a clapping animation on your avatar for three seconds. + * // Clap your hands for 3 seconds then restore animation back to the avatar. + * var ANIM_URL = "https://s3.amazonaws.com/hifi-public/animations/ClapAnimations/ClapHands_Standing.fbx"; + * MyAvatar.overrideAnimation(ANIM_URL, 30, true, 0, 53); + * Script.setTimeout(function () { + * MyAvatar.restoreAnimation(); + * }, 3000); + */ Q_INVOKABLE void restoreAnimation(); - // Returns a list of all clips that are available + /**jsdoc + * Each avatar has an avatar-animation.json file that defines which animations are used and how they are blended together with procedural data + * (such as look at vectors, hand sensors etc.). Each animation specified in the avatar-animation.json file is known as an animation role. + * Animation roles map to easily understandable actions that the avatar can perform, such as "idleStand", "idleTalk", or "walkFwd." + * getAnimationRoles() is used get the list of animation roles defined in the avatar-animation.json. + * @function MyAvatar.getAnimatationRoles + * @example This example prints the list of animation roles defined in the avatar's avatar-animation.json file to the debug log. + * var roles = MyAvatar.getAnimationRoles(); + * print("Animation Roles:"); + * for (var i = 0; i < roles.length; i++) { + * print(roles[i]); + * } + * @returns {string[]} Array of role strings + */ Q_INVOKABLE QStringList getAnimationRoles(); - // Replace an existing standard role animation with a custom one. + /**jsdoc + * Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily understandable actions + * that the avatar can perform, such as "idleStand", "idleTalk", or "walkFwd". To get the full list of roles, use getAnimationRoles(). + * For each role, the avatar-animation.json defines when the animation is used, the animation clip (.FBX) used, and how animations are blended + * together with procedural data (such as look at vectors, hand sensors etc.). + * overrideRoleAnimation() is used to change the animation clip (.FBX) associated with a specified animation role. + * Note: Hand roles only affect the hand. Other 'main' roles, like 'idleStand', 'idleTalk', 'takeoffStand' are full body. + * @function MyAvatar.overrideRoleAnimation + * @example The default avatar-animation.json defines an "idleStand" animation role. This role specifies that when the avatar is not moving, + * an animation clip of the avatar idling with hands hanging at its side will be used. It also specifies that when the avatar moves, the animation + * will smoothly blend to the walking animation used by the "walkFwd" animation role. + * In this example, the "idleStand" role animation clip has been replaced with a clapping animation clip. Now instead of standing with its arms + * hanging at its sides when it is not moving, the avatar will stand and clap its hands. Note that just as it did before, as soon as the avatar + * starts to move, the animation will smoothly blend into the walk animation used by the "walkFwd" animation role. + * // An animation of the avatar clapping its hands while standing + * var ANIM_URL = "https://s3.amazonaws.com/hifi-public/animations/ClapAnimations/ClapHands_Standing.fbx"; + * MyAvatar.overrideRoleAnimation("idleStand", ANIM_URL, 30, true, 0, 53); + * // To restore the default animation, use MyAvatar.restoreRoleAnimation(). + * @param role {string} The animation role to override + * @param url {string} The URL to the animation file. Animation files need to be .FBX format, but only need to contain the avatar skeleton and animation data. + * @param fps {number} The frames per second (FPS) rate for the animation playback. 30 FPS is normal speed. + * @param loop {bool} Set to true if the animation should loop + * @param firstFrame {number} The frame the animation should start at + * @param lastFrame {number} The frame the animation should end at + */ Q_INVOKABLE void overrideRoleAnimation(const QString& role, const QString& url, float fps, bool loop, float firstFrame, float lastFrame); - // remove an animation role override and return to the standard animation. + /**jsdoc + * Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily understandable actions that + * the avatar can perform, such as "idleStand", "idleTalk", or "walkFwd". To get the full list of roles, use getAnimationRoles(). For each role, + * the avatar-animation.json defines when the animation is used, the animation clip (.FBX) used, and how animations are blended together with + * procedural data (such as look at vectors, hand sensors etc.). You can change the animation clip (.FBX) associated with a specified animation + * role using overrideRoleAnimation(). + * restoreRoleAnimation() is used to restore a specified animation role's default animation clip. If you have not specified an override animation + * for the specified role, this function will have no effect. + * @function MyAvatar.restoreRoleAnimation + * @param rule {string} The animation role clip to restore + */ Q_INVOKABLE void restoreRoleAnimation(const QString& role); // Adds handler(animStateDictionaryIn) => animStateDictionaryOut, which will be invoked just before each animGraph state update. diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index c35c7c1ced..a1d4be8376 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -213,7 +213,7 @@ public slots: * @function Overlays.findOverlays * @param {Vec3} center the point to search from. * @param {float} radius search radius - * @return {List of Overlays.OverlayID} list of overlays withing the radius + * @return {Overlays.OverlayID[]} list of overlays withing the radius */ QVector findOverlays(const glm::vec3& center, float radius) const; diff --git a/tools/jsdoc/plugins/hifi.js b/tools/jsdoc/plugins/hifi.js index 8be15c4103..c15f01efe9 100644 --- a/tools/jsdoc/plugins/hifi.js +++ b/tools/jsdoc/plugins/hifi.js @@ -15,13 +15,16 @@ exports.handlers = { // directories to scan for jsdoc comments var dirList = [ '../../interface/src', + '../../interface/src/avatar', '../../interface/src/scripting', '../../interface/src/ui/overlays', - '../../libraries/script-engine/src', - '../../libraries/networking/src', '../../libraries/animation/src', + '../../libraries/avatars/src', + '../../libraries/controllers/src/controllers/', '../../libraries/entities/src', - '../../libraries/shared/src' + '../../libraries/networking/src', + '../../libraries/shared/src', + '../../libraries/script-engine/src', ]; var exts = ['.h', '.cpp']; From c21b8b4eacb52ece02c655fb15cf72543364b727 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 26 Mar 2017 08:48:08 -0700 Subject: [PATCH 7/7] raise max mesh count for static collision entities from 500 to 1000 --- libraries/entities-renderer/src/RenderableModelEntityItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index e94e5df9cb..487a3e1e56 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -812,7 +812,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { auto& meshes = _model->getGeometry()->getMeshes(); int32_t numMeshes = (int32_t)(meshes.size()); - const int MAX_ALLOWED_MESH_COUNT = 500; + const int MAX_ALLOWED_MESH_COUNT = 1000; if (numMeshes > MAX_ALLOWED_MESH_COUNT) { // too many will cause the deadlock timer to throw... shapeInfo.setParams(SHAPE_TYPE_BOX, 0.5f * dimensions);