mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 02:14:26 +02:00
Merge branch 'brown' of github.com:samcake/hifi into brown
This commit is contained in:
commit
fc1d3df613
102 changed files with 325 additions and 102 deletions
|
@ -111,7 +111,7 @@ bool EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
|||
int32_t lodLevelOffset = nodeData->getBoundaryLevelAdjust() + (viewFrustumChanged ? LOW_RES_MOVING_ADJUST : NO_BOUNDARY_ADJUST);
|
||||
newView.lodScaleFactor = powf(2.0f, lodLevelOffset);
|
||||
|
||||
startNewTraversal(newView, root);
|
||||
startNewTraversal(newView, root, isFullScene);
|
||||
|
||||
// When the viewFrustum changed the sort order may be incorrect, so we re-sort
|
||||
// and also use the opportunity to cull anything no longer in view
|
||||
|
@ -220,9 +220,10 @@ bool EntityTreeSendThread::addDescendantsToExtraFlaggedEntities(const QUuid& fil
|
|||
return hasNewChild || hasNewDescendants;
|
||||
}
|
||||
|
||||
void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root) {
|
||||
void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root,
|
||||
bool forceFirstPass) {
|
||||
|
||||
DiffTraversal::Type type = _traversal.prepareNewTraversal(view, root);
|
||||
DiffTraversal::Type type = _traversal.prepareNewTraversal(view, root, forceFirstPass);
|
||||
// there are three types of traversal:
|
||||
//
|
||||
// (1) FirstTime = at login --> find everything in view
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
bool addAncestorsToExtraFlaggedEntities(const QUuid& filteredEntityID, EntityItem& entityItem, EntityNodeData& nodeData);
|
||||
bool addDescendantsToExtraFlaggedEntities(const QUuid& filteredEntityID, EntityItem& entityItem, EntityNodeData& nodeData);
|
||||
|
||||
void startNewTraversal(const DiffTraversal::View& viewFrustum, EntityTreeElementPointer root);
|
||||
void startNewTraversal(const DiffTraversal::View& viewFrustum, EntityTreeElementPointer root, bool forceFirstPass = false);
|
||||
bool traverseTreeAndBuildNextPacketPayload(EncodeBitstreamParams& params, const QJsonObject& jsonFilters) override;
|
||||
|
||||
void preDistributionProcessing() override;
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
*
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {string} buildDate
|
||||
* @property {string} buildVersion
|
||||
* @property {string} qtVersion
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ class AABox;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} presentTime <em>Read-only.</em>
|
||||
* @property {number} engineRunTime <em>Read-only.</em>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @hifi-client-entity
|
||||
* @hifi-interface
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class LocationBookmarks : public Bookmarks, public Dependency {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class SpeechRecognizer : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -31,6 +31,7 @@ class AudioScope : public QObject, public Dependency {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} scopeInput <em>Read-only.</em>
|
||||
* @property {number} scopeOutputLeft <em>Read-only.</em>
|
||||
|
|
|
@ -46,6 +46,7 @@ using SortedAvatar = std::pair<float, std::shared_ptr<Avatar>>;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @borrows AvatarList.getAvatarIdentifiers as getAvatarIdentifiers
|
||||
* @borrows AvatarList.getAvatarsInRange as getAvatarsInRange
|
||||
|
|
|
@ -66,6 +66,7 @@ class MyAvatar : public Avatar {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Vec3} qmlPosition - A synonym for <code>position</code> for use by QML.
|
||||
* @property {boolean} shouldRenderLocally=true - If <code>true</code> then your avatar is rendered for you in Interface,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class DdeFaceTracker : public FaceTracker, public Dependency {
|
||||
|
|
|
@ -27,6 +27,7 @@ class LaserPointerScriptingInterface : public QObject, public Dependency {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
public:
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} PICK_ENTITIES A filter flag. Include domain and avatar entities when intersecting. <em>Read-only.</em>. Deprecated.
|
||||
* @property {number} PICK_OVERLAYS A filter flag. Include local entities when intersecting. <em>Read-only.</em>. Deprecated.
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class PointerScriptingInterface : public QObject, public Dependency {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} PICK_ENTITIES <em>Read-only.</em>
|
||||
* @property {number} PICK_OVERLAYS <em>Read-only.</em>
|
||||
|
|
|
@ -42,6 +42,7 @@ class AccountServicesScriptingInterface : public QObject {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @namespace AccountServices
|
||||
* @property {string} username <em>Read-only.</em>
|
||||
|
|
|
@ -32,6 +32,7 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class ClipboardScriptingInterface : public QObject {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -199,6 +199,7 @@ class ScriptEngine;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Controller.Actions} Actions - Predefined actions on Interface and the user's avatar. These can be used as end
|
||||
* points in a {@link RouteObject} mapping. A synonym for <code>Controller.Hardware.Actions</code>.
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
*
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} width
|
||||
* @property {number} height
|
||||
* @property {number} ALWAYS_ON_TOP - InteractiveWindow flag for always showing a window on top
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class GooglePolyScriptingInterface : public QObject, public Dependency {
|
||||
|
|
|
@ -31,6 +31,7 @@ class QScriptEngine;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Vec3} position - The position of the HMD if currently in VR display mode, otherwise
|
||||
* {@link Vec3(0)|Vec3.ZERO}. <em>Read-only.</em>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {bool} raised - <code>true</code> If the keyboard is visible <code>false</code> otherwise
|
||||
* @property {bool} password - <code>true</code> Will show * instead of characters in the text display <code>false</code> otherwise
|
||||
|
|
|
@ -35,6 +35,7 @@ class MenuItemProperties;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,6 +88,7 @@ protected:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @example <caption>Outline an entity when it is grabbed by a controller.</caption>
|
||||
* // Create a box and copy the following text into the entity's "Script URL" field.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class SettingsScriptingInterface : public QObject {
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} walletStatus
|
||||
* @property {bool} limitedCommerce
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other
|
||||
* chrome), in pixels. <em>Read-only.</em>
|
||||
|
|
|
@ -29,6 +29,7 @@ class AvatarInputs : public QObject {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {boolean} cameraEnabled <em>Read-only.</em>
|
||||
* @property {boolean} cameraMuted <em>Read-only.</em>
|
||||
|
|
|
@ -42,6 +42,7 @@ private:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class Snapshot : public QObject, public Dependency {
|
||||
|
|
|
@ -27,6 +27,7 @@ private: \
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Uuid} keyboardFocusOverlay - Get or set the {@link Overlays.OverlayType|web3d} overlay that has keyboard focus.
|
||||
* If no overlay has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid|Uuid.NULL} to
|
||||
|
|
|
@ -50,6 +50,7 @@ Q_DECLARE_METATYPE(AnimationPointer)
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -30,6 +30,7 @@ class AnimationCacheScriptingInterface : public ScriptableResourceCache, public
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
|
||||
|
|
|
@ -44,6 +44,7 @@ class AudioStreamStatsInterface : public QObject {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} lossRate <em>Read-only.</em>
|
||||
* @property {number} lossCount <em>Read-only.</em>
|
||||
|
@ -192,6 +193,7 @@ class AudioStatsInterface : public QObject {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} pingMs <em>Read-only.</em>
|
||||
* @property {number} inputReadMsMax <em>Read-only.</em>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -61,7 +61,8 @@ class Sound : public Resource {
|
|||
|
||||
public:
|
||||
Sound(const QUrl& url, bool isStereo = false, bool isAmbisonic = false);
|
||||
|
||||
Sound(const Sound& other) : Resource(other), _audioData(other._audioData), _numChannels(other._numChannels) {}
|
||||
|
||||
bool isReady() const { return (bool)_audioData; }
|
||||
|
||||
bool isStereo() const { return _audioData ? _audioData->isStereo() : false; }
|
||||
|
@ -132,6 +133,7 @@ typedef QSharedPointer<Sound> SharedSoundPointer;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -30,6 +30,7 @@ class SoundCacheScriptingInterface : public ScriptableResourceCache, public Depe
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -57,6 +57,7 @@ class UserInputMapper;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
|
|
|
@ -39,6 +39,7 @@ class ScriptingInterface;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
// TODO migrate functionality to a RouteBuilder class and make the proxy defer to that
|
||||
|
|
|
@ -178,6 +178,7 @@ private:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {boolean} allowMouseCapture
|
||||
* @property {number} depth
|
||||
|
|
|
@ -193,7 +193,8 @@ DiffTraversal::DiffTraversal() {
|
|||
_path.reserve(MIN_PATH_DEPTH);
|
||||
}
|
||||
|
||||
DiffTraversal::Type DiffTraversal::prepareNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root) {
|
||||
DiffTraversal::Type DiffTraversal::prepareNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root,
|
||||
bool forceFirstPass) {
|
||||
assert(root);
|
||||
// there are three types of traversal:
|
||||
//
|
||||
|
@ -212,7 +213,7 @@ DiffTraversal::Type DiffTraversal::prepareNewTraversal(const DiffTraversal::View
|
|||
|
||||
Type type;
|
||||
// If usesViewFrustum changes, treat it as a First traversal
|
||||
if (_completedView.startTime == 0 || _currentView.usesViewFrustums() != _completedView.usesViewFrustums()) {
|
||||
if (forceFirstPass || _completedView.startTime == 0 || _currentView.usesViewFrustums() != _completedView.usesViewFrustums()) {
|
||||
type = Type::First;
|
||||
_currentView.viewFrustums = view.viewFrustums;
|
||||
_currentView.lodScaleFactor = view.lodScaleFactor;
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
DiffTraversal();
|
||||
|
||||
Type prepareNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root);
|
||||
Type prepareNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root, bool forceFirstPass = false);
|
||||
|
||||
const View& getCurrentView() const { return _currentView; }
|
||||
|
||||
|
|
|
@ -2640,15 +2640,8 @@ bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const {
|
|||
|
||||
static const QString SERVER_SCRIPTS_PROPERTY = "serverScripts";
|
||||
|
||||
foreach(const auto& property, jsonFilters.keys()) {
|
||||
if (property == SERVER_SCRIPTS_PROPERTY && jsonFilters[property] == EntityQueryFilterSymbol::NonDefault) {
|
||||
// check if this entity has a non-default value for serverScripts
|
||||
if (_serverScripts != ENTITY_ITEM_DEFAULT_SERVER_SCRIPTS) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (jsonFilters[SERVER_SCRIPTS_PROPERTY] == EntityQueryFilterSymbol::NonDefault) {
|
||||
return _serverScripts != ENTITY_ITEM_DEFAULT_SERVER_SCRIPTS;
|
||||
}
|
||||
|
||||
// the json filter syntax did not match what we expected, return a match
|
||||
|
|
|
@ -109,6 +109,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -397,8 +397,6 @@ public:
|
|||
bool isDefined() const { return _defined; }
|
||||
|
||||
Texture(TextureUsageType usageType);
|
||||
Texture(const Texture& buf); // deep copy of the sysmem texture
|
||||
Texture& operator=(const Texture& buf); // deep copy of the sysmem texture
|
||||
~Texture();
|
||||
|
||||
Stamp getStamp() const { return _stamp; }
|
||||
|
@ -693,8 +691,10 @@ class TextureSource {
|
|||
public:
|
||||
TextureSource(const QUrl& url, int type = 0) : _imageUrl(url), _type(type) {}
|
||||
|
||||
void setUrl(const QUrl& url) { _imageUrl = url; }
|
||||
const QUrl& getUrl() const { return _imageUrl; }
|
||||
const gpu::TexturePointer getGPUTexture() const { return _gpuTexture; }
|
||||
void setType(int type) { _type = type; }
|
||||
int getType() const { return _type; }
|
||||
|
||||
void resetTexture(gpu::TexturePointer texture);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class GraphicsScriptingInterface : public QObject, public QScriptable, public Dependency {
|
||||
|
|
|
@ -121,6 +121,7 @@ public:
|
|||
/// A texture map.
|
||||
class Texture {
|
||||
public:
|
||||
|
||||
QString id;
|
||||
QString name;
|
||||
QByteArray filename;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
|
||||
class Midi : public QObject, public Dependency {
|
||||
|
|
|
@ -322,7 +322,7 @@ private:
|
|||
void GeometryDefinitionResource::setExtra(void* extra) {
|
||||
const GeometryExtra* geometryExtra = static_cast<const GeometryExtra*>(extra);
|
||||
_mapping = geometryExtra ? geometryExtra->mapping : QVariantHash();
|
||||
_textureBaseUrl = resolveTextureBaseUrl(_url, geometryExtra ? geometryExtra->textureBaseUrl : QUrl());
|
||||
_textureBaseUrl = geometryExtra ? resolveTextureBaseUrl(_url, geometryExtra->textureBaseUrl) : QUrl();
|
||||
_combineParts = geometryExtra ? geometryExtra->combineParts : true;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class ModelCacheScriptingInterface : public ScriptableResourceCache, public Depe
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
|
||||
* @property {number} numCached - Total number of cached resource. <em>Read-only.</em>
|
||||
|
|
|
@ -336,6 +336,7 @@ int networkTexturePointerMetaTypeId = qRegisterMetaType<QWeakPointer<NetworkText
|
|||
|
||||
NetworkTexture::NetworkTexture(const QUrl& url, bool resourceTexture) :
|
||||
Resource(url),
|
||||
Texture(),
|
||||
_maxNumPixels(100)
|
||||
{
|
||||
if (resourceTexture) {
|
||||
|
@ -346,6 +347,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, bool resourceTexture) :
|
|||
|
||||
NetworkTexture::NetworkTexture(const NetworkTexture& other) :
|
||||
Resource(other),
|
||||
Texture(other),
|
||||
_type(other._type),
|
||||
_sourceChannel(other._sourceChannel),
|
||||
_currentlyLoadingResourceType(other._currentlyLoadingResourceType),
|
||||
|
@ -373,7 +375,12 @@ void NetworkTexture::setExtra(void* extra) {
|
|||
_maxNumPixels = textureExtra ? textureExtra->maxNumPixels : ABSOLUTE_MAX_TEXTURE_NUM_PIXELS;
|
||||
_sourceChannel = textureExtra ? textureExtra->sourceChannel : image::ColorChannel::NONE;
|
||||
|
||||
_textureSource = std::make_shared<gpu::TextureSource>(_url, (int)_type);
|
||||
if (_textureSource) {
|
||||
_textureSource->setUrl(_url);
|
||||
_textureSource->setType((int)_type);
|
||||
} else {
|
||||
_textureSource = std::make_shared<gpu::TextureSource>(_url, (int)_type);
|
||||
}
|
||||
_lowestRequestedMipLevel = 0;
|
||||
|
||||
auto fileNameLowercase = _url.fileName().toLower();
|
||||
|
@ -533,7 +540,6 @@ void NetworkTexture::makeRequest() {
|
|||
} else {
|
||||
qWarning(networking) << "NetworkTexture::makeRequest() called while not in a valid state: " << _ktxResourceState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void NetworkTexture::handleLocalRequestCompleted() {
|
||||
|
|
|
@ -30,6 +30,7 @@ class TextureCacheScriptingInterface : public ScriptableResourceCache, public De
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
|
||||
* @property {number} numCached - Total number of cached resource. <em>Read-only.</em>
|
||||
|
|
|
@ -43,6 +43,7 @@ const QString GET_PLACE = "/api/v1/places/%1";
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid|Uuid.NULL} if you're not
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
|
|
|
@ -362,7 +362,6 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
|||
resource->moveToThread(qApp->thread());
|
||||
connect(resource.data(), &Resource::updateSize, this, &ResourceCache::updateTotalSize);
|
||||
resourcesWithExtraHash.insert(extraHash, resource);
|
||||
removeUnusedResource(resource);
|
||||
resource->ensureLoading();
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +403,7 @@ void ResourceCache::addUnusedResource(const QSharedPointer<Resource>& resource)
|
|||
// If it doesn't fit or its size is unknown, remove it from the cache.
|
||||
if (resource->getBytes() == 0 || resource->getBytes() > _unusedResourcesMaxSize) {
|
||||
resource->setCache(nullptr);
|
||||
removeResource(resource->getURL(), resource->getBytes());
|
||||
removeResource(resource->getURL(), resource->getExtraHash(), resource->getBytes());
|
||||
resetTotalResourceCounter();
|
||||
return;
|
||||
}
|
||||
|
@ -443,7 +442,7 @@ void ResourceCache::reserveUnusedResource(qint64 resourceSize) {
|
|||
auto size = it.value()->getBytes();
|
||||
|
||||
locker.unlock();
|
||||
removeResource(it.value()->getURL(), size);
|
||||
removeResource(it.value()->getURL(), it.value()->getExtraHash(), size);
|
||||
locker.relock();
|
||||
|
||||
_unusedResourcesSize -= size;
|
||||
|
@ -489,9 +488,13 @@ void ResourceCache::resetResourceCounters() {
|
|||
emit dirty();
|
||||
}
|
||||
|
||||
void ResourceCache::removeResource(const QUrl& url, qint64 size) {
|
||||
void ResourceCache::removeResource(const QUrl& url, size_t extraHash, qint64 size) {
|
||||
QWriteLocker locker(&_resourcesLock);
|
||||
_resources.remove(url);
|
||||
auto& resources = _resources[url];
|
||||
resources.remove(extraHash);
|
||||
if (resources.size() == 0) {
|
||||
_resources.remove(url);
|
||||
}
|
||||
_totalResourcesSize -= size;
|
||||
}
|
||||
|
||||
|
@ -664,7 +667,7 @@ void Resource::allReferencesCleared() {
|
|||
} else {
|
||||
if (_cache) {
|
||||
// remove from the cache
|
||||
_cache->removeResource(getURL(), getBytes());
|
||||
_cache->removeResource(getURL(), getExtraHash(), getBytes());
|
||||
_cache->resetTotalResourceCounter();
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ class ScriptableResource : public QObject {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
@ -271,7 +272,7 @@ private:
|
|||
friend class ScriptableResourceCache;
|
||||
|
||||
void reserveUnusedResource(qint64 resourceSize);
|
||||
void removeResource(const QUrl& url, qint64 size = 0);
|
||||
void removeResource(const QUrl& url, size_t extraHash, qint64 size = 0);
|
||||
|
||||
void resetTotalResourceCounter();
|
||||
void resetUnusedResourceCounter();
|
||||
|
@ -418,6 +419,7 @@ public:
|
|||
|
||||
virtual void setExtra(void* extra) {};
|
||||
void setExtraHash(size_t extraHash) { _extraHash = extraHash; }
|
||||
size_t getExtraHash() const { return _extraHash; }
|
||||
|
||||
signals:
|
||||
/// Fired when the resource begins downloading.
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {boolean} running - <em>Read-only.</em>
|
||||
*/
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} Ray Ray picks intersect a ray with the nearest object in front of them, along a given direction.
|
||||
* @property {number} Stylus Stylus picks provide "tapping" functionality on/into flat surfaces.
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -28,6 +28,7 @@ class QScriptValue;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
class RecordingScriptingInterface : public QObject, public Dependency {
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace SceneScripting {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {string} backgroundMode
|
||||
* @property {Scene.Stage.KeyLight} keyLight
|
||||
|
@ -178,6 +179,7 @@ namespace SceneScripting {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {boolean} shouldRenderAvatars
|
||||
* @property {boolean} shouldRenderEntities
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -588,6 +588,7 @@ static void scriptableResourceFromScriptValue(const QScriptValue& value, Scripta
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -104,6 +104,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -32,6 +32,7 @@ class ScriptEngine;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {string} debugScriptUrl
|
||||
* @property {string} defaultScriptsPath
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class ScriptsModel : public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class ScriptsModelFilter : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
* @property {boolean} canKick - <code>true</code> if the domain server allows the node or avatar to kick (ban) avatars,
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @deprecated The Paths API is deprecated. Use {@link Script.resolvePath} and {@link Script.resourcesPath} instead.
|
||||
* @readonly
|
||||
|
|
|
@ -645,6 +645,7 @@ using MeshPointer = std::shared_ptr<graphics::Mesh>;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @hifi-server-entity
|
||||
* @hifi-assignment-client
|
||||
*
|
||||
|
|
|
@ -43,6 +43,7 @@ class Camera : public QObject {
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Vec3} position - The position of the camera. You can set this value only when the camera is in independent
|
||||
* mode.
|
||||
|
|
|
@ -196,6 +196,7 @@ public:
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {number} cpuRunTime - <em>Read-only.</em>
|
||||
* @property {boolean} enabled
|
||||
|
|
|
@ -44,7 +44,8 @@ using namespace InteractiveWindowEnums;
|
|||
* @class InteractiveWindow
|
||||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-en
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {string} title
|
||||
* @property {Vec2} position
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
* @property {boolean} navigationFocused
|
||||
* @property {boolean} navigationFocusDisabled
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {string} url - <em>Read-only.</em>
|
||||
* @property {Vec2} position
|
||||
|
|
|
@ -24,7 +24,8 @@ class QScriptContext;
|
|||
* @param {OverlayWindow.Properties} [properties=null]
|
||||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-en
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Vec2} position
|
||||
* @property {Vec2} size
|
||||
|
|
|
@ -43,12 +43,14 @@ class OffscreenQmlSurface;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
/**jsdoc
|
||||
* @namespace tabletInterface
|
||||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @deprecated This API is deprecated and will be removed. Use {@link Tablet} instead.
|
||||
*/
|
||||
|
@ -208,6 +210,7 @@ Q_DECLARE_METATYPE(TabletButtonsProxyModel*);
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {string} name - Name of this tablet. <em>Read-only.</em>
|
||||
* @property {boolean} toolbarMode - Used to transition this tablet into and out of toolbar mode.
|
||||
|
@ -456,6 +459,7 @@ Q_DECLARE_METATYPE(TabletProxy*);
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @property {Uuid} uuid - Uniquely identifies this button. <em>Read-only.</em>
|
||||
* @property {TabletButtonProxy.ButtonProperties} properties
|
||||
|
|
|
@ -24,6 +24,7 @@ class QQuickItem;
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class ToolbarButtonProxy : public QmlWrapper {
|
||||
Q_OBJECT
|
||||
|
@ -83,6 +84,7 @@ Q_DECLARE_METATYPE(ToolbarButtonProxy*);
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class ToolbarProxy : public QmlWrapper {
|
||||
Q_OBJECT
|
||||
|
@ -136,6 +138,7 @@ Q_DECLARE_METATYPE(ToolbarProxy*);
|
|||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*/
|
||||
class ToolbarScriptingInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -107,6 +107,9 @@ exports.handlers = {
|
|||
if (e.doclet.hifiClientEntity) {
|
||||
rows.push("Client Entity Scripts");
|
||||
}
|
||||
if (e.doclet.hifiAvatar) {
|
||||
rows.push("Avatar Scripts");
|
||||
}
|
||||
if (e.doclet.hifiServerEntity) {
|
||||
rows.push("Server Entity Scripts");
|
||||
}
|
||||
|
@ -140,6 +143,14 @@ exports.defineTags = function (dictionary) {
|
|||
}
|
||||
});
|
||||
|
||||
// @hifi-avatar-script
|
||||
dictionary.defineTag("hifi-avatar", {
|
||||
onTagged: function (doclet, tag) {
|
||||
doclet.hifiAvatar = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// @hifi-client-entity
|
||||
dictionary.defineTag("hifi-client-entity", {
|
||||
onTagged: function (doclet, tag) {
|
||||
|
|
|
@ -18,7 +18,7 @@ Nitpick has 5 functions, separated into separate tabs:
|
|||
### Windows
|
||||
1. (First time) download and install Python 3 from https://hifi-qa.s3.amazonaws.com/nitpick/Windows/python-3.7.0-amd64.exe (also located at https://www.python.org/downloads/)
|
||||
1. Click the "add python to path" checkbox on the python installer
|
||||
1. After installation - create an environment variable called PYTHON_PATH and set it to the folder containing the Python executable.
|
||||
1. After installation - add the path to python.exe to the Windows PATH environment variable.
|
||||
1. (First time) download and install AWS CLI from https://hifi-qa.s3.amazonaws.com/nitpick/Windows/AWSCLI64PY3.msi (also available at https://aws.amazon.com/cli/
|
||||
1. Open a new command prompt and run
|
||||
`aws configure`
|
||||
|
@ -31,7 +31,7 @@ Nitpick has 5 functions, separated into separate tabs:
|
|||
1. (First time) Download adb (Android Debug Bridge) from *https://dl.google.com/android/repository/platform-tools-latest-windows.zip*
|
||||
1. Copy the downloaded file to (for example) **C:\adb** and extract in place.
|
||||
Verify you see *adb.exe* in **C:\adb\platform-tools\\**.
|
||||
1. Create an environment variable named ADB_PATH and set its value to the installation location (e.g. **C:\adb**)
|
||||
1. After installation - add the path to adb.exe to the Windows PATH environment variable (note that it is in *adb\platform-tools*).
|
||||
### Mac
|
||||
1. (first time) Install brew
|
||||
In a terminal:
|
||||
|
|
38
tools/nitpick/src/AdbInterface.cpp
Normal file
38
tools/nitpick/src/AdbInterface.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// AdbInterface.cpp
|
||||
//
|
||||
// Created by Nissim Hadar on Feb 11, 2019.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "AdbInterface.h"
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
QString AdbInterface::getAdbCommand() {
|
||||
#ifdef Q_OS_WIN
|
||||
if (_adbCommand.isNull()) {
|
||||
QString adbPath = PathUtils::getPathToExecutable("adb.exe");
|
||||
if (!adbPath.isNull()) {
|
||||
_adbCommand = adbPath + _adbExe;
|
||||
} else {
|
||||
QMessageBox::critical(0, "python.exe not found",
|
||||
"Please verify that pyton.exe is in the PATH");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
#elif defined Q_OS_MAC
|
||||
_adbCommand = "/usr/local/bin/adb";
|
||||
if (!QFile::exists(_adbCommand)) {
|
||||
QMessageBox::critical(0, "adb not found",
|
||||
"adb not found at " + _adbCommand);
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return _adbCommand;
|
||||
}
|
30
tools/nitpick/src/AdbInterface.h
Normal file
30
tools/nitpick/src/AdbInterface.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// AdbInterface.h
|
||||
//
|
||||
// Created by Nissim Hadar on Feb 11, 2019.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#ifndef hifi_AdbInterface_h
|
||||
#define hifi_AdbInterface_h
|
||||
|
||||
#include <QString>
|
||||
|
||||
class AdbInterface {
|
||||
public:
|
||||
QString getAdbCommand();
|
||||
|
||||
private:
|
||||
#ifdef Q_OS_WIN
|
||||
const QString _adbExe{ "adb.exe" };
|
||||
#else
|
||||
// Both Mac and Linux use "python"
|
||||
const QString _adbExe{ "adb" };
|
||||
#endif
|
||||
|
||||
QString _adbCommand;
|
||||
};
|
||||
|
||||
#endif // hifi_AdbInterface_h
|
|
@ -40,7 +40,7 @@ Nitpick::Nitpick(QWidget* parent) : QMainWindow(parent) {
|
|||
|
||||
_ui.plainTextEdit->setReadOnly(true);
|
||||
|
||||
setWindowTitle("Nitpick - v2.1.0");
|
||||
setWindowTitle("Nitpick - v2.1.1");
|
||||
}
|
||||
|
||||
Nitpick::~Nitpick() {
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "TestRunnerDesktop.h"
|
||||
#include "TestRunnerMobile.h"
|
||||
|
||||
#include "AWSInterface.h"
|
||||
|
||||
class Nitpick : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -112,8 +110,6 @@ private:
|
|||
TestRunnerDesktop* _testRunnerDesktop{ nullptr };
|
||||
TestRunnerMobile* _testRunnerMobile{ nullptr };
|
||||
|
||||
AWSInterface _awsInterface;
|
||||
|
||||
std::vector<Downloader*> _downloaders;
|
||||
|
||||
// local storage for parameters - folder to store downloaded files in, and a list of their names
|
||||
|
|
31
tools/nitpick/src/PathUtils.cpp
Normal file
31
tools/nitpick/src/PathUtils.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// PathUtils.h
|
||||
//
|
||||
// Created by Nissim Hadar on 11 Feb 2019.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "PathUtils.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
|
||||
QString PathUtils::getPathToExecutable(const QString& executableName) {
|
||||
QString path = QProcessEnvironment::systemEnvironment().value("PATH");
|
||||
|
||||
QStringList pathLocations = path.replace('\\', '/').split(';');
|
||||
|
||||
foreach (QString pathLocation, pathLocations) {
|
||||
if (pathLocation[pathLocation.length() - 1] != '/') {
|
||||
pathLocation += '/';
|
||||
}
|
||||
if (QFile::exists(pathLocation + executableName)) {
|
||||
return pathLocation;
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
20
tools/nitpick/src/PathUtils.h
Normal file
20
tools/nitpick/src/PathUtils.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// PathUtils.h
|
||||
//
|
||||
// Created by Nissim Hadar on 11 Feb 2019.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#ifndef hifi_PathUtils_h
|
||||
#define hifi_PathUtils_h
|
||||
|
||||
#include <QString>
|
||||
|
||||
class PathUtils {
|
||||
public:
|
||||
static QString getPathToExecutable(const QString& executableName);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -8,36 +8,31 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "PythonInterface.h"
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
|
||||
PythonInterface::PythonInterface() {
|
||||
QString PythonInterface::getPythonCommand() {
|
||||
#ifdef Q_OS_WIN
|
||||
if (QProcessEnvironment::systemEnvironment().contains("PYTHON_PATH")) {
|
||||
QString pythonPath = QProcessEnvironment::systemEnvironment().value("PYTHON_PATH");
|
||||
if (!QFile::exists(pythonPath + "/" + _pythonExe)) {
|
||||
QMessageBox::critical(0, _pythonExe, QString("Python executable not found in ") + pythonPath);
|
||||
if (_pythonCommand.isNull()) {
|
||||
QString pythonPath = PathUtils::getPathToExecutable("python.exe");
|
||||
if (!pythonPath.isNull()) {
|
||||
_pythonCommand = pythonPath + _pythonExe;
|
||||
} else {
|
||||
QMessageBox::critical(0, "python.exe not found",
|
||||
"Please verify that pyton.exe is in the PATH");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
_pythonCommand = pythonPath + "/" + _pythonExe;
|
||||
} else {
|
||||
QMessageBox::critical(0, "PYTHON_PATH not defined",
|
||||
"Please set PYTHON_PATH to directory containing the Python executable");
|
||||
exit(-1);
|
||||
}
|
||||
#elif defined Q_OS_MAC
|
||||
_pythonCommand = "/usr/local/bin/python3";
|
||||
if (!QFile::exists(_pythonCommand)) {
|
||||
QMessageBox::critical(0, "python not found",
|
||||
"python3 not found at " + _pythonCommand);
|
||||
"python3 not found at " + _pythonCommand);
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QString PythonInterface::getPythonCommand() {
|
||||
return _pythonCommand;
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
class PythonInterface {
|
||||
public:
|
||||
PythonInterface();
|
||||
|
||||
QString getPythonCommand();
|
||||
|
||||
private:
|
||||
|
|
|
@ -24,7 +24,7 @@ extern Nitpick* nitpick;
|
|||
|
||||
#include <math.h>
|
||||
|
||||
Test::Test(QProgressBar* progressBar, QCheckBox* checkBoxInteractiveMode) {
|
||||
Test::Test(QProgressBar* progressBar, QCheckBox* checkBoxInteractiveMode) : _awsInterface(NULL) {
|
||||
_progressBar = progressBar;
|
||||
_checkBoxInteractiveMode = checkBoxInteractiveMode;
|
||||
|
||||
|
@ -966,11 +966,15 @@ void Test::createTestRailTestCases() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_testRailInterface) {
|
||||
_testRailInterface = new TestRailInterface;
|
||||
}
|
||||
|
||||
if (_testRailCreateMode == PYTHON) {
|
||||
_testRailInterface.createTestSuitePython(_testDirectory, outputDirectory, nitpick->getSelectedUser(),
|
||||
_testRailInterface->createTestSuitePython(_testDirectory, outputDirectory, nitpick->getSelectedUser(),
|
||||
nitpick->getSelectedBranch());
|
||||
} else {
|
||||
_testRailInterface.createTestSuiteXML(_testDirectory, outputDirectory, nitpick->getSelectedUser(),
|
||||
_testRailInterface->createTestSuiteXML(_testDirectory, outputDirectory, nitpick->getSelectedUser(),
|
||||
nitpick->getSelectedBranch());
|
||||
}
|
||||
}
|
||||
|
@ -983,7 +987,12 @@ void Test::createTestRailRun() {
|
|||
return;
|
||||
}
|
||||
|
||||
_testRailInterface.createTestRailRun(outputDirectory);
|
||||
|
||||
if (!_testRailInterface) {
|
||||
_testRailInterface = new TestRailInterface;
|
||||
}
|
||||
|
||||
_testRailInterface->createTestRailRun(outputDirectory);
|
||||
}
|
||||
|
||||
void Test::updateTestRailRunResult() {
|
||||
|
@ -999,7 +1008,12 @@ void Test::updateTestRailRunResult() {
|
|||
return;
|
||||
}
|
||||
|
||||
_testRailInterface.updateTestRailRunResults(testResults, tempDirectory);
|
||||
|
||||
if (!_testRailInterface) {
|
||||
_testRailInterface = new TestRailInterface;
|
||||
}
|
||||
|
||||
_testRailInterface->updateTestRailRunResults(testResults, tempDirectory);
|
||||
}
|
||||
|
||||
QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) {
|
||||
|
@ -1088,5 +1102,9 @@ void Test::createWebPage(QCheckBox* updateAWSCheckBox, QLineEdit* urlLineEdit) {
|
|||
return;
|
||||
}
|
||||
|
||||
_awsInterface.createWebPageFromResults(testResults, workingDirectory, updateAWSCheckBox, urlLineEdit);
|
||||
if (!_awsInterface) {
|
||||
_awsInterface = new AWSInterface;
|
||||
}
|
||||
|
||||
_awsInterface->createWebPageFromResults(testResults, workingDirectory, updateAWSCheckBox, urlLineEdit);
|
||||
}
|
|
@ -159,10 +159,10 @@ private:
|
|||
|
||||
bool _exitWhenComplete{ false };
|
||||
|
||||
TestRailInterface _testRailInterface;
|
||||
TestRailInterface* _testRailInterface;
|
||||
TestRailCreateMode _testRailCreateMode { PYTHON };
|
||||
|
||||
AWSInterface _awsInterface;
|
||||
AWSInterface* _awsInterface;
|
||||
};
|
||||
|
||||
#endif // hifi_test_h
|
|
@ -20,7 +20,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
|
||||
TestRailInterface::TestRailInterface() {
|
||||
TestRailInterface::TestRailInterface() : _pythonInterface(NULL) {
|
||||
_testRailTestCasesSelectorWindow.setURL("https://highfidelity.testrail.net");
|
||||
_testRailTestCasesSelectorWindow.setUser("@highfidelity.io");
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ TestRunnerMobile::TestRunnerMobile(
|
|||
QLabel* statusLabel,
|
||||
|
||||
QObject* parent
|
||||
) : QObject(parent)
|
||||
) : QObject(parent), _adbInterface(NULL)
|
||||
{
|
||||
_workingFolderLabel = workingFolderLabel;
|
||||
_connectDeviceButton = connectDeviceButton;
|
||||
|
@ -47,30 +47,6 @@ TestRunnerMobile::TestRunnerMobile(
|
|||
folderLineEdit->setText("/sdcard/DCIM/TEST");
|
||||
|
||||
modelNames["SM_G955U1"] = "Samsung S8+ unlocked";
|
||||
|
||||
// Find ADB (Android Debugging Bridge)
|
||||
#ifdef Q_OS_WIN
|
||||
if (QProcessEnvironment::systemEnvironment().contains("ADB_PATH")) {
|
||||
QString adbExePath = QProcessEnvironment::systemEnvironment().value("ADB_PATH") + "/platform-tools";
|
||||
if (!QFile::exists(adbExePath + "/" + _adbExe)) {
|
||||
QMessageBox::critical(0, _adbExe, QString("ADB executable not found in ") + adbExePath);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
_adbCommand = adbExePath + "/" + _adbExe;
|
||||
} else {
|
||||
QMessageBox::critical(0, "ADB_PATH not defined",
|
||||
"Please set ADB_PATH to directory containing the `adb` executable");
|
||||
exit(-1);
|
||||
}
|
||||
#elif defined Q_OS_MAC
|
||||
_adbCommand = "/usr/local/bin/adb";
|
||||
if (!QFile::exists(_adbCommand)) {
|
||||
QMessageBox::critical(0, "adb not found",
|
||||
"python3 not found at " + _adbCommand);
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TestRunnerMobile::~TestRunnerMobile() {
|
||||
|
@ -84,8 +60,12 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
|
|||
|
||||
void TestRunnerMobile::connectDevice() {
|
||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
||||
if (!_adbInterface) {
|
||||
_adbInterface = new AdbInterface();
|
||||
}
|
||||
|
||||
QString devicesFullFilename{ _workingFolder + "/devices.txt" };
|
||||
QString command = _adbCommand + " devices -l > " + devicesFullFilename;
|
||||
QString command = _adbInterface->getAdbCommand() + " devices -l > " + devicesFullFilename;
|
||||
system(command.toStdString().c_str());
|
||||
|
||||
if (!QFile::exists(devicesFullFilename)) {
|
||||
|
@ -100,12 +80,13 @@ void TestRunnerMobile::connectDevice() {
|
|||
QString line2 = devicesFile.readLine();
|
||||
|
||||
const QString DEVICE{ "device" };
|
||||
if (line2.contains(DEVICE)) {
|
||||
// Make sure only 1 device
|
||||
if (line2.contains("unauthorized")) {
|
||||
QMessageBox::critical(0, "Unauthorized device detected", "Please allow USB debugging on device");
|
||||
} else if (line2.contains(DEVICE)) {
|
||||
// Make sure only 1 device
|
||||
QString line3 = devicesFile.readLine();
|
||||
if (line3.contains(DEVICE)) {
|
||||
QMessageBox::critical(0, "Too many devices detected", "Tests will run only if a single device is attached");
|
||||
|
||||
} else {
|
||||
// Line looks like this: 988a1b47335239434b device product:dream2qlteue model:SM_G955U1 device:dream2qlteue transport_id:2
|
||||
QStringList tokens = line2.split(QRegExp("[\r\n\t ]+"));
|
||||
|
@ -169,8 +150,12 @@ void TestRunnerMobile::downloadComplete() {
|
|||
|
||||
void TestRunnerMobile::installAPK() {
|
||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
||||
if (!_adbInterface) {
|
||||
_adbInterface = new AdbInterface();
|
||||
}
|
||||
|
||||
_statusLabel->setText("Installing");
|
||||
QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt";
|
||||
QString command = _adbInterface->getAdbCommand() + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt";
|
||||
system(command.toStdString().c_str());
|
||||
_statusLabel->setText("Installation complete");
|
||||
_runInterfacePushbutton->setEnabled(true);
|
||||
|
@ -179,8 +164,12 @@ void TestRunnerMobile::installAPK() {
|
|||
|
||||
void TestRunnerMobile::runInterface() {
|
||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
||||
if (!_adbInterface) {
|
||||
_adbInterface = new AdbInterface();
|
||||
}
|
||||
|
||||
_statusLabel->setText("Starting Interface");
|
||||
QString command = _adbCommand + " shell monkey -p io.highfidelity.hifiinterface -v 1";
|
||||
QString command = _adbInterface->getAdbCommand() + " shell monkey -p io.highfidelity.hifiinterface -v 1";
|
||||
system(command.toStdString().c_str());
|
||||
_statusLabel->setText("Interface started");
|
||||
#endif
|
||||
|
@ -188,8 +177,12 @@ void TestRunnerMobile::runInterface() {
|
|||
|
||||
void TestRunnerMobile::pullFolder() {
|
||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
||||
if (!_adbInterface) {
|
||||
_adbInterface = new AdbInterface();
|
||||
}
|
||||
|
||||
_statusLabel->setText("Pulling folder");
|
||||
QString command = _adbCommand + " pull " + _folderLineEdit->text() + " " + _workingFolder + _installerFilename;
|
||||
QString command = _adbInterface->getAdbCommand() + " pull " + _folderLineEdit->text() + " " + _workingFolder + _installerFilename;
|
||||
system(command.toStdString().c_str());
|
||||
_statusLabel->setText("Pull complete");
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue