mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 05:48:26 +02:00
Case 19754 - Remove logging URLs and related file locations.
The goal is to strip out data that can be used by untoward users in copying models, avatars, etc.
This commit is contained in:
parent
e80468e423
commit
cef7000a72
36 changed files with 84 additions and 201 deletions
|
@ -110,7 +110,7 @@ void AnimClip::copyFromNetworkAnim() {
|
||||||
for (int i = 0; i < animJointCount; i++) {
|
for (int i = 0; i < animJointCount; i++) {
|
||||||
int skeletonJoint = _skeleton->nameToJointIndex(animSkeleton.getJointName(i));
|
int skeletonJoint = _skeleton->nameToJointIndex(animSkeleton.getJointName(i));
|
||||||
if (skeletonJoint == -1) {
|
if (skeletonJoint == -1) {
|
||||||
qCWarning(animation) << "animation contains joint =" << animSkeleton.getJointName(i) << " which is not in the skeleton, url =" << _url;
|
qCWarning(animation) << "animation contains joint =" << animSkeleton.getJointName(i) << " which is not in the skeleton";
|
||||||
}
|
}
|
||||||
jointMap.push_back(skeletonJoint);
|
jointMap.push_back(skeletonJoint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,26 +221,26 @@ static NodeProcessFunc animNodeTypeToProcessFunc(AnimNode::Type type) {
|
||||||
static AnimNode::Pointer loadNode(const QJsonObject& jsonObj, const QUrl& jsonUrl) {
|
static AnimNode::Pointer loadNode(const QJsonObject& jsonObj, const QUrl& jsonUrl) {
|
||||||
auto idVal = jsonObj.value("id");
|
auto idVal = jsonObj.value("id");
|
||||||
if (!idVal.isString()) {
|
if (!idVal.isString()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad string \"id\", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad string \"id\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QString id = idVal.toString();
|
QString id = idVal.toString();
|
||||||
|
|
||||||
auto typeVal = jsonObj.value("type");
|
auto typeVal = jsonObj.value("type");
|
||||||
if (!typeVal.isString()) {
|
if (!typeVal.isString()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad object \"type\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad object \"type\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QString typeStr = typeVal.toString();
|
QString typeStr = typeVal.toString();
|
||||||
AnimNode::Type type = stringToAnimNodeType(typeStr);
|
AnimNode::Type type = stringToAnimNodeType(typeStr);
|
||||||
if (type == AnimNode::Type::NumTypes) {
|
if (type == AnimNode::Type::NumTypes) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, unknown node type" << typeStr << ", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, unknown node type" << typeStr << ", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dataValue = jsonObj.value("data");
|
auto dataValue = jsonObj.value("data");
|
||||||
if (!dataValue.isObject()) {
|
if (!dataValue.isObject()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad string \"data\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad string \"data\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto dataObj = dataValue.toObject();
|
auto dataObj = dataValue.toObject();
|
||||||
|
@ -263,13 +263,13 @@ static AnimNode::Pointer loadNode(const QJsonObject& jsonObj, const QUrl& jsonUr
|
||||||
|
|
||||||
auto childrenValue = jsonObj.value("children");
|
auto childrenValue = jsonObj.value("children");
|
||||||
if (!childrenValue.isArray()) {
|
if (!childrenValue.isArray()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad array \"children\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad array \"children\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto childrenArray = childrenValue.toArray();
|
auto childrenArray = childrenValue.toArray();
|
||||||
for (const auto& childValue : childrenArray) {
|
for (const auto& childValue : childrenArray) {
|
||||||
if (!childValue.isObject()) {
|
if (!childValue.isObject()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad object in \"children\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad object in \"children\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
AnimNode::Pointer child = loadNode(childValue.toObject(), jsonUrl);
|
AnimNode::Pointer child = loadNode(childValue.toObject(), jsonUrl);
|
||||||
|
@ -353,14 +353,14 @@ static AnimNode::Pointer loadBlendLinearMoveNode(const QJsonObject& jsonObj, con
|
||||||
std::vector<float> characteristicSpeeds;
|
std::vector<float> characteristicSpeeds;
|
||||||
auto speedsValue = jsonObj.value("characteristicSpeeds");
|
auto speedsValue = jsonObj.value("characteristicSpeeds");
|
||||||
if (!speedsValue.isArray()) {
|
if (!speedsValue.isArray()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad array \"characteristicSpeeds\" in blendLinearMove node, id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad array \"characteristicSpeeds\" in blendLinearMove node, id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto speedsArray = speedsValue.toArray();
|
auto speedsArray = speedsValue.toArray();
|
||||||
for (const auto& speedValue : speedsArray) {
|
for (const auto& speedValue : speedsArray) {
|
||||||
if (!speedValue.isDouble()) {
|
if (!speedValue.isDouble()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad number in \"characteristicSpeeds\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad number in \"characteristicSpeeds\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
float speedVal = (float)speedValue.toDouble();
|
float speedVal = (float)speedValue.toDouble();
|
||||||
|
@ -434,7 +434,7 @@ static AnimNode::Pointer loadOverlayNode(const QJsonObject& jsonObj, const QStri
|
||||||
|
|
||||||
auto boneSetEnum = stringToBoneSetEnum(boneSet);
|
auto boneSetEnum = stringToBoneSetEnum(boneSet);
|
||||||
if (boneSetEnum == AnimOverlay::NumBoneSets) {
|
if (boneSetEnum == AnimOverlay::NumBoneSets) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, unknown bone set =" << boneSet << ", defaulting to \"fullBody\", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, unknown bone set =" << boneSet << ", defaulting to \"fullBody\"";
|
||||||
boneSetEnum = AnimOverlay::FullBodyBoneSet;
|
boneSetEnum = AnimOverlay::FullBodyBoneSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,14 +470,14 @@ static AnimNode::Pointer loadManipulatorNode(const QJsonObject& jsonObj, const Q
|
||||||
|
|
||||||
auto jointsValue = jsonObj.value("joints");
|
auto jointsValue = jsonObj.value("joints");
|
||||||
if (!jointsValue.isArray()) {
|
if (!jointsValue.isArray()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad array \"joints\" in controller node, id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad array \"joints\" in controller node, id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto jointsArray = jointsValue.toArray();
|
auto jointsArray = jointsValue.toArray();
|
||||||
for (const auto& jointValue : jointsArray) {
|
for (const auto& jointValue : jointsArray) {
|
||||||
if (!jointValue.isObject()) {
|
if (!jointValue.isObject()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad state object in \"joints\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad state object in \"joints\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto jointObj = jointValue.toObject();
|
auto jointObj = jointValue.toObject();
|
||||||
|
@ -490,13 +490,13 @@ static AnimNode::Pointer loadManipulatorNode(const QJsonObject& jsonObj, const Q
|
||||||
|
|
||||||
AnimManipulator::JointVar::Type jointVarRotationType = stringToAnimManipulatorJointVarType(rotationType);
|
AnimManipulator::JointVar::Type jointVarRotationType = stringToAnimManipulatorJointVarType(rotationType);
|
||||||
if (jointVarRotationType == AnimManipulator::JointVar::Type::NumTypes) {
|
if (jointVarRotationType == AnimManipulator::JointVar::Type::NumTypes) {
|
||||||
qCWarning(animation) << "AnimNodeLoader, bad rotationType in \"joints\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCWarning(animation) << "AnimNodeLoader, bad rotationType in \"joints\", id =" << id;
|
||||||
jointVarRotationType = AnimManipulator::JointVar::Type::Default;
|
jointVarRotationType = AnimManipulator::JointVar::Type::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimManipulator::JointVar::Type jointVarTranslationType = stringToAnimManipulatorJointVarType(translationType);
|
AnimManipulator::JointVar::Type jointVarTranslationType = stringToAnimManipulatorJointVarType(translationType);
|
||||||
if (jointVarTranslationType == AnimManipulator::JointVar::Type::NumTypes) {
|
if (jointVarTranslationType == AnimManipulator::JointVar::Type::NumTypes) {
|
||||||
qCWarning(animation) << "AnimNodeLoader, bad translationType in \"joints\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCWarning(animation) << "AnimNodeLoader, bad translationType in \"joints\", id =" << id;
|
||||||
jointVarTranslationType = AnimManipulator::JointVar::Type::Default;
|
jointVarTranslationType = AnimManipulator::JointVar::Type::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,14 +512,14 @@ AnimNode::Pointer loadInverseKinematicsNode(const QJsonObject& jsonObj, const QS
|
||||||
|
|
||||||
auto targetsValue = jsonObj.value("targets");
|
auto targetsValue = jsonObj.value("targets");
|
||||||
if (!targetsValue.isArray()) {
|
if (!targetsValue.isArray()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad array \"targets\" in inverseKinematics node, id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad array \"targets\" in inverseKinematics node, id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto targetsArray = targetsValue.toArray();
|
auto targetsArray = targetsValue.toArray();
|
||||||
for (const auto& targetValue : targetsArray) {
|
for (const auto& targetValue : targetsArray) {
|
||||||
if (!targetValue.isObject()) {
|
if (!targetValue.isObject()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad state object in \"targets\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad state object in \"targets\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto targetObj = targetValue.toObject();
|
auto targetObj = targetValue.toObject();
|
||||||
|
@ -536,7 +536,7 @@ AnimNode::Pointer loadInverseKinematicsNode(const QJsonObject& jsonObj, const QS
|
||||||
|
|
||||||
auto flexCoefficientsValue = targetObj.value("flexCoefficients");
|
auto flexCoefficientsValue = targetObj.value("flexCoefficients");
|
||||||
if (!flexCoefficientsValue.isArray()) {
|
if (!flexCoefficientsValue.isArray()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad or missing flexCoefficients array in \"targets\", id =" << id << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad or missing flexCoefficients array in \"targets\", id =" << id;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto flexCoefficientsArray = flexCoefficientsValue.toArray();
|
auto flexCoefficientsArray = flexCoefficientsValue.toArray();
|
||||||
|
@ -554,10 +554,11 @@ AnimNode::Pointer loadInverseKinematicsNode(const QJsonObject& jsonObj, const QS
|
||||||
AnimInverseKinematics::SolutionSource solutionSourceType = stringToSolutionSourceEnum(solutionSource);
|
AnimInverseKinematics::SolutionSource solutionSourceType = stringToSolutionSourceEnum(solutionSource);
|
||||||
if (solutionSourceType != AnimInverseKinematics::SolutionSource::NumSolutionSources) {
|
if (solutionSourceType != AnimInverseKinematics::SolutionSource::NumSolutionSources) {
|
||||||
node->setSolutionSource(solutionSourceType);
|
node->setSolutionSource(solutionSourceType);
|
||||||
} else {
|
|
||||||
qCWarning(animation) << "AnimNodeLoader, bad solutionSourceType in \"solutionSource\", id = " << id << ", url = " << jsonUrl.toDisplayString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
qCWarning(animation) << "AnimNodeLoader, bad solutionSourceType in \"solutionSource\", id = " << id;
|
||||||
|
}
|
||||||
|
|
||||||
READ_OPTIONAL_STRING(solutionSourceVar, jsonObj);
|
READ_OPTIONAL_STRING(solutionSourceVar, jsonObj);
|
||||||
|
|
||||||
|
@ -622,7 +623,7 @@ bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj,
|
||||||
|
|
||||||
auto statesValue = jsonObj.value("states");
|
auto statesValue = jsonObj.value("states");
|
||||||
if (!statesValue.isArray()) {
|
if (!statesValue.isArray()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad array \"states\" in stateMachine node, id =" << nodeId << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad array \"states\" in stateMachine node, id =" << nodeId;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +642,7 @@ bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj,
|
||||||
auto statesArray = statesValue.toArray();
|
auto statesArray = statesValue.toArray();
|
||||||
for (const auto& stateValue : statesArray) {
|
for (const auto& stateValue : statesArray) {
|
||||||
if (!stateValue.isObject()) {
|
if (!stateValue.isObject()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad state object in \"states\", id =" << nodeId << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad state object in \"states\", id =" << nodeId;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto stateObj = stateValue.toObject();
|
auto stateObj = stateValue.toObject();
|
||||||
|
@ -657,7 +658,7 @@ bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj,
|
||||||
|
|
||||||
auto iter = childMap.find(id);
|
auto iter = childMap.find(id);
|
||||||
if (iter == childMap.end()) {
|
if (iter == childMap.end()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, could not find stateMachine child (state) with nodeId =" << nodeId << "stateId =" << id << "url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, could not find stateMachine child (state) with nodeId =" << nodeId << "stateId =" << id;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +666,7 @@ bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj,
|
||||||
if (!interpType.isEmpty()) {
|
if (!interpType.isEmpty()) {
|
||||||
interpTypeEnum = stringToInterpType(interpType);
|
interpTypeEnum = stringToInterpType(interpType);
|
||||||
if (interpTypeEnum == AnimStateMachine::InterpType::NumTypes) {
|
if (interpTypeEnum == AnimStateMachine::InterpType::NumTypes) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad interpType on stateMachine state, nodeId = " << nodeId << "stateId =" << id << "url = " << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad interpType on stateMachine state, nodeId = " << nodeId << "stateId =" << id;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,14 +689,14 @@ bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj,
|
||||||
|
|
||||||
auto transitionsValue = stateObj.value("transitions");
|
auto transitionsValue = stateObj.value("transitions");
|
||||||
if (!transitionsValue.isArray()) {
|
if (!transitionsValue.isArray()) {
|
||||||
qCritical(animation) << "AnimNodeLoader, bad array \"transitions\" in stateMachine node, stateId =" << id << "nodeId =" << nodeId << "url =" << jsonUrl.toDisplayString();
|
qCritical(animation) << "AnimNodeLoader, bad array \"transitions\" in stateMachine node, stateId =" << id << "nodeId =" << nodeId;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto transitionsArray = transitionsValue.toArray();
|
auto transitionsArray = transitionsValue.toArray();
|
||||||
for (const auto& transitionValue : transitionsArray) {
|
for (const auto& transitionValue : transitionsArray) {
|
||||||
if (!transitionValue.isObject()) {
|
if (!transitionValue.isObject()) {
|
||||||
qCritical(animation) << "AnimNodeLoader, bad transition object in \"transtions\", stateId =" << id << "nodeId =" << nodeId << "url =" << jsonUrl.toDisplayString();
|
qCritical(animation) << "AnimNodeLoader, bad transition object in \"transtions\", stateId =" << id << "nodeId =" << nodeId;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto transitionObj = transitionValue.toObject();
|
auto transitionObj = transitionValue.toObject();
|
||||||
|
@ -714,14 +715,14 @@ bool processStateMachineNode(AnimNode::Pointer node, const QJsonObject& jsonObj,
|
||||||
if (iter != stateMap.end()) {
|
if (iter != stateMap.end()) {
|
||||||
srcState->addTransition(AnimStateMachine::State::Transition(transition.second.first, iter->second));
|
srcState->addTransition(AnimStateMachine::State::Transition(transition.second.first, iter->second));
|
||||||
} else {
|
} else {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad state machine transtion from srcState =" << srcState->_id << "dstState =" << transition.second.second << "nodeId =" << nodeId << "url = " << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad state machine transtion from srcState =" << srcState->_id << "dstState =" << transition.second.second << "nodeId =" << nodeId;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto iter = stateMap.find(currentState);
|
auto iter = stateMap.find(currentState);
|
||||||
if (iter == stateMap.end()) {
|
if (iter == stateMap.end()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad currentState =" << currentState << "could not find child node" << "id =" << nodeId << "url = " << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad currentState =" << currentState << "could not find child node" << "id =" << nodeId;
|
||||||
}
|
}
|
||||||
smNode->setCurrentState(iter->second);
|
smNode->setCurrentState(iter->second);
|
||||||
|
|
||||||
|
@ -745,7 +746,7 @@ AnimNode::Pointer AnimNodeLoader::load(const QByteArray& contents, const QUrl& j
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
auto doc = QJsonDocument::fromJson(contents, &error);
|
auto doc = QJsonDocument::fromJson(contents, &error);
|
||||||
if (error.error != QJsonParseError::NoError) {
|
if (error.error != QJsonParseError::NoError) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, failed to parse json, error =" << error.errorString() << ", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, failed to parse json, error =" << error.errorString();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QJsonObject obj = doc.object();
|
QJsonObject obj = doc.object();
|
||||||
|
@ -753,7 +754,7 @@ AnimNode::Pointer AnimNodeLoader::load(const QByteArray& contents, const QUrl& j
|
||||||
// version
|
// version
|
||||||
QJsonValue versionVal = obj.value("version");
|
QJsonValue versionVal = obj.value("version");
|
||||||
if (!versionVal.isString()) {
|
if (!versionVal.isString()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad string \"version\", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad string \"version\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QString version = versionVal.toString();
|
QString version = versionVal.toString();
|
||||||
|
@ -761,14 +762,14 @@ AnimNode::Pointer AnimNodeLoader::load(const QByteArray& contents, const QUrl& j
|
||||||
// check version
|
// check version
|
||||||
// AJT: TODO version check
|
// AJT: TODO version check
|
||||||
if (version != "1.0" && version != "1.1") {
|
if (version != "1.0" && version != "1.1") {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad version number" << version << "expected \"1.0\", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad version number" << version << "expected \"1.0\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// root
|
// root
|
||||||
QJsonValue rootVal = obj.value("root");
|
QJsonValue rootVal = obj.value("root");
|
||||||
if (!rootVal.isObject()) {
|
if (!rootVal.isObject()) {
|
||||||
qCCritical(animation) << "AnimNodeLoader, bad object \"root\", url =" << jsonUrl.toDisplayString();
|
qCCritical(animation) << "AnimNodeLoader, bad object \"root\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,15 +134,13 @@ void Animation::downloadFinished(const QByteArray& data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::animationParseSuccess(HFMModel::Pointer hfmModel) {
|
void Animation::animationParseSuccess(HFMModel::Pointer hfmModel) {
|
||||||
|
qCDebug(animation) << "Animation parse success";
|
||||||
qCDebug(animation) << "Animation parse success" << _url.toDisplayString();
|
|
||||||
|
|
||||||
_hfmModel = hfmModel;
|
_hfmModel = hfmModel;
|
||||||
finishedLoading(true);
|
finishedLoading(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::animationParseError(int error, QString str) {
|
void Animation::animationParseError(int error, QString str) {
|
||||||
qCCritical(animation) << "Animation failure parsing " << _url.toDisplayString() << "code =" << error << str;
|
qCCritical(animation) << "Animation parse error, code =" << error << str;
|
||||||
emit failed(QNetworkReply::UnknownContentError);
|
emit failed(QNetworkReply::UnknownContentError);
|
||||||
finishedLoading(false);
|
finishedLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1829,7 +1829,7 @@ void Rig::initAnimGraph(const QUrl& url) {
|
||||||
emit onLoadComplete();
|
emit onLoadComplete();
|
||||||
});
|
});
|
||||||
connect(_animLoader.get(), &AnimNodeLoader::error, [url](int error, QString str) {
|
connect(_animLoader.get(), &AnimNodeLoader::error, [url](int error, QString str) {
|
||||||
qCritical(animation) << "Error loading" << url.toDisplayString() << "code = " << error << "str =" << str;
|
qCritical(animation) << "Error loading: code = " << error << "str =" << str;
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(_networkLoader.get(), &AnimNodeLoader::success, [this, weakSkeletonPtr, networkUrl](AnimNode::Pointer nodeIn) {
|
connect(_networkLoader.get(), &AnimNodeLoader::success, [this, weakSkeletonPtr, networkUrl](AnimNode::Pointer nodeIn) {
|
||||||
|
@ -1855,7 +1855,7 @@ void Rig::initAnimGraph(const QUrl& url) {
|
||||||
|
|
||||||
});
|
});
|
||||||
connect(_networkLoader.get(), &AnimNodeLoader::error, [networkUrl](int error, QString str) {
|
connect(_networkLoader.get(), &AnimNodeLoader::error, [networkUrl](int error, QString str) {
|
||||||
qCritical(animation) << "Error loading" << networkUrl.toDisplayString() << "code = " << error << "str =" << str;
|
qCritical(animation) << "Error loading: code = " << error << "str =" << str;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ void Sound::downloadFinished(const QByteArray& data) {
|
||||||
|
|
||||||
void Sound::soundProcessSuccess(QByteArray data, bool stereo, bool ambisonic, float duration) {
|
void Sound::soundProcessSuccess(QByteArray data, bool stereo, bool ambisonic, float duration) {
|
||||||
|
|
||||||
qCDebug(audio) << "Setting ready state for sound file" << _url.toDisplayString();
|
qCDebug(audio) << "Setting ready state for sound file";
|
||||||
|
|
||||||
_byteArray = data;
|
_byteArray = data;
|
||||||
_isStereo = stereo;
|
_isStereo = stereo;
|
||||||
|
@ -81,14 +81,14 @@ void Sound::soundProcessSuccess(QByteArray data, bool stereo, bool ambisonic, fl
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::soundProcessError(int error, QString str) {
|
void Sound::soundProcessError(int error, QString str) {
|
||||||
qCCritical(audio) << "Failed to process sound file" << _url.toDisplayString() << "code =" << error << str;
|
qCCritical(audio) << "Failed to process sound file: code =" << error << str;
|
||||||
emit failed(QNetworkReply::UnknownContentError);
|
emit failed(QNetworkReply::UnknownContentError);
|
||||||
finishedLoading(false);
|
finishedLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundProcessor::run() {
|
void SoundProcessor::run() {
|
||||||
|
|
||||||
qCDebug(audio) << "Processing sound file" << _url.toDisplayString();
|
qCDebug(audio) << "Processing sound file";
|
||||||
|
|
||||||
// replace our byte array with the downloaded data
|
// replace our byte array with the downloaded data
|
||||||
QByteArray rawAudioByteArray = QByteArray(_data);
|
QByteArray rawAudioByteArray = QByteArray(_data);
|
||||||
|
@ -129,7 +129,7 @@ void SoundProcessor::run() {
|
||||||
// since it's raw the only way for us to know that is if the file was called .stereo.raw
|
// since it's raw the only way for us to know that is if the file was called .stereo.raw
|
||||||
if (fileName.toLower().endsWith("stereo.raw")) {
|
if (fileName.toLower().endsWith("stereo.raw")) {
|
||||||
_isStereo = true;
|
_isStereo = true;
|
||||||
qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << _url << "as stereo audio file.";
|
qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes as stereo audio file.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process as 48khz RAW file
|
// Process as 48khz RAW file
|
||||||
|
|
|
@ -35,7 +35,6 @@ SharedSoundPointer SoundCache::getSound(const QUrl& url) {
|
||||||
|
|
||||||
QSharedPointer<Resource> SoundCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
QSharedPointer<Resource> SoundCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||||
const void* extra) {
|
const void* extra) {
|
||||||
qCDebug(audio) << "Requesting sound at" << url.toString();
|
|
||||||
auto resource = QSharedPointer<Resource>(new Sound(url), &Resource::deleter);
|
auto resource = QSharedPointer<Resource>(new Sound(url), &Resource::deleter);
|
||||||
resource->setLoadPriority(this, SOUNDS_LOADING_PRIORITY);
|
resource->setLoadPriority(this, SOUNDS_LOADING_PRIORITY);
|
||||||
return resource;
|
return resource;
|
||||||
|
|
|
@ -1517,16 +1517,16 @@ void Avatar::setModelURLFinished(bool success) {
|
||||||
const int MAX_SKELETON_DOWNLOAD_ATTEMPTS = 4; // NOTE: we don't want to be as generous as ResourceCache is, we only want 4 attempts
|
const int MAX_SKELETON_DOWNLOAD_ATTEMPTS = 4; // NOTE: we don't want to be as generous as ResourceCache is, we only want 4 attempts
|
||||||
if (_skeletonModel->getResourceDownloadAttemptsRemaining() <= 0 ||
|
if (_skeletonModel->getResourceDownloadAttemptsRemaining() <= 0 ||
|
||||||
_skeletonModel->getResourceDownloadAttempts() > MAX_SKELETON_DOWNLOAD_ATTEMPTS) {
|
_skeletonModel->getResourceDownloadAttempts() > MAX_SKELETON_DOWNLOAD_ATTEMPTS) {
|
||||||
qCWarning(avatars_renderer) << "Using default after failing to load Avatar model: " << _skeletonModelURL
|
qCWarning(avatars_renderer) << "Using default after failing to load Avatar model, "
|
||||||
<< "after" << _skeletonModel->getResourceDownloadAttempts() << "attempts.";
|
<< "after" << _skeletonModel->getResourceDownloadAttempts() << "attempts.";
|
||||||
|
|
||||||
// call _skeletonModel.setURL, but leave our copy of _skeletonModelURL alone. This is so that
|
// call _skeletonModel.setURL, but leave our copy of _skeletonModelURL alone. This is so that
|
||||||
// we don't redo this every time we receive an identity packet from the avatar with the bad url.
|
// we don't redo this every time we receive an identity packet from the avatar with the bad url.
|
||||||
QMetaObject::invokeMethod(_skeletonModel.get(), "setURL",
|
QMetaObject::invokeMethod(_skeletonModel.get(), "setURL",
|
||||||
Qt::QueuedConnection, Q_ARG(QUrl, AvatarData::defaultFullAvatarModelUrl()));
|
Qt::QueuedConnection, Q_ARG(QUrl, AvatarData::defaultFullAvatarModelUrl()));
|
||||||
} else {
|
} else {
|
||||||
qCWarning(avatars_renderer) << "Avatar model: " << _skeletonModelURL
|
qCWarning(avatars_renderer) << "Avatar model failed to load... attempts:"
|
||||||
<< "failed to load... attempts:" << _skeletonModel->getResourceDownloadAttempts()
|
<< _skeletonModel->getResourceDownloadAttempts() << "out of:" << MAX_SKELETON_DOWNLOAD_ATTEMPTS;
|
||||||
<< "out of:" << MAX_SKELETON_DOWNLOAD_ATTEMPTS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
|
@ -1999,7 +1999,6 @@ void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_skeletonModelURL = expanded;
|
_skeletonModelURL = expanded;
|
||||||
qCDebug(avatars) << "Changing skeleton model for avatar" << getSessionUUID() << "to" << _skeletonModelURL.toString();
|
|
||||||
|
|
||||||
updateJointMappings();
|
updateJointMappings();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ void AmbientLightPropertyGroup::merge(const AmbientLightPropertyGroup& other) {
|
||||||
void AmbientLightPropertyGroup::debugDump() const {
|
void AmbientLightPropertyGroup::debugDump() const {
|
||||||
qCDebug(entities) << " AmbientLightPropertyGroup: ---------------------------------------------";
|
qCDebug(entities) << " AmbientLightPropertyGroup: ---------------------------------------------";
|
||||||
qCDebug(entities) << " ambientIntensity:" << getAmbientIntensity();
|
qCDebug(entities) << " ambientIntensity:" << getAmbientIntensity();
|
||||||
qCDebug(entities) << " ambientURL:" << getAmbientURL();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmbientLightPropertyGroup::listChangedProperties(QList<QString>& out) {
|
void AmbientLightPropertyGroup::listChangedProperties(QList<QString>& out) {
|
||||||
|
|
|
@ -173,7 +173,6 @@ void AnimationPropertyGroup::setFromOldAnimationSettings(const QString& value) {
|
||||||
|
|
||||||
void AnimationPropertyGroup::debugDump() const {
|
void AnimationPropertyGroup::debugDump() const {
|
||||||
qCDebug(entities) << " AnimationPropertyGroup: ---------------------------------------------";
|
qCDebug(entities) << " AnimationPropertyGroup: ---------------------------------------------";
|
||||||
qCDebug(entities) << " url:" << getURL() << " has changed:" << urlChanged();
|
|
||||||
qCDebug(entities) << " fps:" << getFPS() << " has changed:" << fpsChanged();
|
qCDebug(entities) << " fps:" << getFPS() << " has changed:" << fpsChanged();
|
||||||
qCDebug(entities) << "currentFrame:" << getCurrentFrame() << " has changed:" << currentFrameChanged();
|
qCDebug(entities) << "currentFrame:" << getCurrentFrame() << " has changed:" << currentFrameChanged();
|
||||||
qCDebug(entities) << "allowTranslation:" << getAllowTranslation() << " has changed:" << allowTranslationChanged();
|
qCDebug(entities) << "allowTranslation:" << getAllowTranslation() << " has changed:" << allowTranslationChanged();
|
||||||
|
|
|
@ -203,14 +203,13 @@ void EntityEditFilters::addFilter(EntityItemID entityID, QString filterURL) {
|
||||||
auto scriptRequest = DependencyManager::get<ResourceManager>()->createResourceRequest(
|
auto scriptRequest = DependencyManager::get<ResourceManager>()->createResourceRequest(
|
||||||
this, scriptURL, true, -1, "EntityEditFilters::addFilter");
|
this, scriptURL, true, -1, "EntityEditFilters::addFilter");
|
||||||
if (!scriptRequest) {
|
if (!scriptRequest) {
|
||||||
qWarning() << "Could not create ResourceRequest for Entity Edit filter script at" << scriptURL.toString();
|
qWarning() << "Could not create ResourceRequest for Entity Edit filter.";
|
||||||
scriptRequestFinished(entityID);
|
scriptRequestFinished(entityID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Agent.cpp sets up a timeout here, but that is unnecessary, as ResourceRequest has its own.
|
// Agent.cpp sets up a timeout here, but that is unnecessary, as ResourceRequest has its own.
|
||||||
connect(scriptRequest, &ResourceRequest::finished, this, [this, entityID]{ EntityEditFilters::scriptRequestFinished(entityID);} );
|
connect(scriptRequest, &ResourceRequest::finished, this, [this, entityID]{ EntityEditFilters::scriptRequestFinished(entityID);} );
|
||||||
// FIXME: handle atp rquests setup here. See Agent::requestScript()
|
// FIXME: handle atp rquests setup here. See Agent::requestScript()
|
||||||
qInfo() << "Requesting script at URL" << qPrintable(scriptRequest->getUrl().toString());
|
|
||||||
scriptRequest->send();
|
scriptRequest->send();
|
||||||
qDebug() << "script request sent for entity " << entityID;
|
qDebug() << "script request sent for entity " << entityID;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +222,7 @@ static bool hasCorrectSyntax(const QScriptProgram& program) {
|
||||||
const auto error = syntaxCheck.errorMessage();
|
const auto error = syntaxCheck.errorMessage();
|
||||||
const auto line = QString::number(syntaxCheck.errorLineNumber());
|
const auto line = QString::number(syntaxCheck.errorLineNumber());
|
||||||
const auto column = QString::number(syntaxCheck.errorColumnNumber());
|
const auto column = QString::number(syntaxCheck.errorColumnNumber());
|
||||||
const auto message = QString("[SyntaxError] %1 in %2:%3(%4)").arg(error, program.fileName(), line, column);
|
const auto message = QString("[SyntaxError] %1 in %2(%3)").arg(error, line, column);
|
||||||
qCritical() << qPrintable(message);
|
qCritical() << qPrintable(message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -236,8 +235,8 @@ static bool hadUncaughtExceptions(QScriptEngine& engine, const QString& fileName
|
||||||
const auto line = QString::number(engine.uncaughtExceptionLineNumber());
|
const auto line = QString::number(engine.uncaughtExceptionLineNumber());
|
||||||
engine.clearExceptions();
|
engine.clearExceptions();
|
||||||
|
|
||||||
static const QString SCRIPT_EXCEPTION_FORMAT = "[UncaughtException] %1 in %2:%3";
|
static const QString SCRIPT_EXCEPTION_FORMAT = "[UncaughtException] %1 on line %2";
|
||||||
auto message = QString(SCRIPT_EXCEPTION_FORMAT).arg(exception, fileName, line);
|
auto message = QString(SCRIPT_EXCEPTION_FORMAT).arg(exception, line);
|
||||||
if (!backtrace.empty()) {
|
if (!backtrace.empty()) {
|
||||||
static const auto lineSeparator = "\n ";
|
static const auto lineSeparator = "\n ";
|
||||||
message += QString("\n[Backtrace]%1%2").arg(lineSeparator, backtrace.join(lineSeparator));
|
message += QString("\n[Backtrace]%1%2").arg(lineSeparator, backtrace.join(lineSeparator));
|
||||||
|
@ -376,7 +375,7 @@ void EntityEditFilters::scriptRequestFinished(EntityItemID entityID) {
|
||||||
}
|
}
|
||||||
} else if (scriptRequest) {
|
} else if (scriptRequest) {
|
||||||
const QString urlString = scriptRequest->getUrl().toString();
|
const QString urlString = scriptRequest->getUrl().toString();
|
||||||
qCritical() << "Failed to download script at" << urlString;
|
qCritical() << "Failed to download script";
|
||||||
// See HTTPResourceRequest::onRequestFinished for interpretation of codes. For example, a 404 is code 6 and 403 is 3. A timeout is 2. Go figure.
|
// See HTTPResourceRequest::onRequestFinished for interpretation of codes. For example, a 404 is code 6 and 403 is 3. A timeout is 2. Go figure.
|
||||||
qCritical() << "ResourceRequest error was" << scriptRequest->getResult();
|
qCritical() << "ResourceRequest error was" << scriptRequest->getResult();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2006,7 +2006,5 @@ HFMModel* readFBX(QIODevice* device, const QVariantHash& mapping, const QString&
|
||||||
reader._loadLightmaps = loadLightmaps;
|
reader._loadLightmaps = loadLightmaps;
|
||||||
reader._lightmapLevel = lightmapLevel;
|
reader._lightmapLevel = lightmapLevel;
|
||||||
|
|
||||||
qCDebug(modelformat) << "Reading FBX: " << url;
|
|
||||||
|
|
||||||
return reader.extractHFMModel(mapping, url);
|
return reader.extractHFMModel(mapping, url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -937,7 +937,6 @@ HFMModel* GLTFReader::readGLTF(QByteArray& data, const QVariantHash& mapping,
|
||||||
bool GLTFReader::readBinary(const QString& url, QByteArray& outdata) {
|
bool GLTFReader::readBinary(const QString& url, QByteArray& outdata) {
|
||||||
QUrl binaryUrl = _url.resolved(url);
|
QUrl binaryUrl = _url.resolved(url);
|
||||||
|
|
||||||
qCDebug(modelformat) << "binaryUrl: " << binaryUrl << " OriginalUrl: " << _url;
|
|
||||||
bool success;
|
bool success;
|
||||||
std::tie<bool, QByteArray>(success, outdata) = requestData(binaryUrl);
|
std::tie<bool, QByteArray>(success, outdata) = requestData(binaryUrl);
|
||||||
|
|
||||||
|
@ -1006,8 +1005,6 @@ HFMTexture GLTFReader::getHFMTexture(const GLTFTexture& texture) {
|
||||||
QString fname = QUrl(url).fileName();
|
QString fname = QUrl(url).fileName();
|
||||||
QUrl textureUrl = _url.resolved(url);
|
QUrl textureUrl = _url.resolved(url);
|
||||||
qCDebug(modelformat) << "fname: " << fname;
|
qCDebug(modelformat) << "fname: " << fname;
|
||||||
qCDebug(modelformat) << "textureUrl: " << textureUrl;
|
|
||||||
qCDebug(modelformat) << "Url: " << _url;
|
|
||||||
fbxtex.name = fname;
|
fbxtex.name = fname;
|
||||||
fbxtex.filename = textureUrl.toEncoded();
|
fbxtex.filename = textureUrl.toEncoded();
|
||||||
}
|
}
|
||||||
|
@ -1289,14 +1286,6 @@ void GLTFReader::hfmDebugDump(const HFMModel& hfmModel) {
|
||||||
qCDebug(modelformat) << " normalTexture =" << mat.normalTexture.filename;
|
qCDebug(modelformat) << " normalTexture =" << mat.normalTexture.filename;
|
||||||
qCDebug(modelformat) << " albedoTexture =" << mat.albedoTexture.filename;
|
qCDebug(modelformat) << " albedoTexture =" << mat.albedoTexture.filename;
|
||||||
qCDebug(modelformat) << " opacityTexture =" << mat.opacityTexture.filename;
|
qCDebug(modelformat) << " opacityTexture =" << mat.opacityTexture.filename;
|
||||||
qCDebug(modelformat) << " glossTexture =" << mat.glossTexture.filename;
|
|
||||||
qCDebug(modelformat) << " roughnessTexture =" << mat.roughnessTexture.filename;
|
|
||||||
qCDebug(modelformat) << " specularTexture =" << mat.specularTexture.filename;
|
|
||||||
qCDebug(modelformat) << " metallicTexture =" << mat.metallicTexture.filename;
|
|
||||||
qCDebug(modelformat) << " emissiveTexture =" << mat.emissiveTexture.filename;
|
|
||||||
qCDebug(modelformat) << " occlusionTexture =" << mat.occlusionTexture.filename;
|
|
||||||
qCDebug(modelformat) << " scatteringTexture =" << mat.scatteringTexture.filename;
|
|
||||||
qCDebug(modelformat) << " lightmapTexture =" << mat.lightmapTexture.filename;
|
|
||||||
|
|
||||||
qCDebug(modelformat) << " lightmapParams =" << mat.lightmapParams;
|
qCDebug(modelformat) << " lightmapParams =" << mat.lightmapParams;
|
||||||
|
|
||||||
|
|
|
@ -361,9 +361,6 @@ struct GLTFImage {
|
||||||
int bufferView; //required (or)
|
int bufferView; //required (or)
|
||||||
QMap<QString, bool> defined;
|
QMap<QString, bool> defined;
|
||||||
void dump() {
|
void dump() {
|
||||||
if (defined["uri"]) {
|
|
||||||
qCDebug(modelformat) << "uri: " << uri;
|
|
||||||
}
|
|
||||||
if (defined["mimeType"]) {
|
if (defined["mimeType"]) {
|
||||||
qCDebug(modelformat) << "mimeType: " << mimeType;
|
qCDebug(modelformat) << "mimeType: " << mimeType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ uint16 KtxStorage::minAvailableMipLevel() const {
|
||||||
|
|
||||||
void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& storage) {
|
void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& storage) {
|
||||||
if (level != _minMipLevelAvailable - 1) {
|
if (level != _minMipLevelAvailable - 1) {
|
||||||
qWarning() << "Invalid level to be stored, expected: " << (_minMipLevelAvailable - 1) << ", got: " << level << " " << _filename.c_str();
|
qWarning() << "Invalid level to be stored, expected: " << (_minMipLevelAvailable - 1) << ", got: " << level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,20 +271,20 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor
|
||||||
auto& imageDesc = _ktxDescriptor->images[level];
|
auto& imageDesc = _ktxDescriptor->images[level];
|
||||||
if (storage->size() != imageDesc._imageSize) {
|
if (storage->size() != imageDesc._imageSize) {
|
||||||
qWarning() << "Invalid image size: " << storage->size() << ", expected: " << imageDesc._imageSize
|
qWarning() << "Invalid image size: " << storage->size() << ", expected: " << imageDesc._imageSize
|
||||||
<< ", level: " << level << ", filename: " << QString::fromStdString(_filename);
|
<< ", level: " << level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(*_cacheFileMutex);
|
std::lock_guard<std::mutex> lock(*_cacheFileMutex);
|
||||||
auto file = maybeOpenFile();
|
auto file = maybeOpenFile();
|
||||||
if (!file) {
|
if (!file) {
|
||||||
qWarning() << "Failed to open file to assign mip data " << QString::fromStdString(_filename);
|
qWarning() << "Failed to open file to assign mip data ";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fileData = file->mutableData();
|
auto fileData = file->mutableData();
|
||||||
if (!fileData) {
|
if (!fileData) {
|
||||||
qWarning() << "Failed to get mutable data for " << QString::fromStdString(_filename);
|
qWarning() << "Failed to get mutable data for ";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,8 +214,6 @@ QImage processRawImageData(QIODevice& content, const std::string& filename) {
|
||||||
newImageReader.setDevice(&content);
|
newImageReader.setDevice(&content);
|
||||||
|
|
||||||
if (newImageReader.canRead()) {
|
if (newImageReader.canRead()) {
|
||||||
qCWarning(imagelogging) << "Image file" << filename.c_str() << "has extension" << filenameExtension.c_str()
|
|
||||||
<< "but is actually a" << qPrintable(newImageReader.format()) << "(recovering)";
|
|
||||||
return newImageReader.read();
|
return newImageReader.read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +236,7 @@ gpu::TexturePointer processImage(std::shared_ptr<QIODevice> content, const std::
|
||||||
// Validate that the image loaded
|
// Validate that the image loaded
|
||||||
if (imageWidth == 0 || imageHeight == 0 || image.format() == QImage::Format_Invalid) {
|
if (imageWidth == 0 || imageHeight == 0 || image.format() == QImage::Format_Invalid) {
|
||||||
QString reason(image.format() == QImage::Format_Invalid ? "(Invalid Format)" : "(Size is invalid)");
|
QString reason(image.format() == QImage::Format_Invalid ? "(Invalid Format)" : "(Size is invalid)");
|
||||||
qCWarning(imagelogging) << "Failed to load" << filename.c_str() << qPrintable(reason);
|
qCWarning(imagelogging) << "Failed to load:" << qPrintable(reason);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +248,7 @@ gpu::TexturePointer processImage(std::shared_ptr<QIODevice> content, const std::
|
||||||
imageWidth = (int)(scaleFactor * (float)imageWidth + 0.5f);
|
imageWidth = (int)(scaleFactor * (float)imageWidth + 0.5f);
|
||||||
imageHeight = (int)(scaleFactor * (float)imageHeight + 0.5f);
|
imageHeight = (int)(scaleFactor * (float)imageHeight + 0.5f);
|
||||||
image = image.scaled(QSize(imageWidth, imageHeight), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
image = image.scaled(QSize(imageWidth, imageHeight), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
qCDebug(imagelogging).nospace() << "Downscaled " << filename.c_str() << " (" <<
|
qCDebug(imagelogging).nospace() << "Downscaled " << " (" <<
|
||||||
QSize(originalWidth, originalHeight) << " to " <<
|
QSize(originalWidth, originalHeight) << " to " <<
|
||||||
QSize(imageWidth, imageHeight) << ")";
|
QSize(imageWidth, imageHeight) << ")";
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,6 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
|
||||||
QString filename = _mapping.value("filename").toString();
|
QString filename = _mapping.value("filename").toString();
|
||||||
|
|
||||||
if (filename.isNull()) {
|
if (filename.isNull()) {
|
||||||
qCDebug(modelnetworking) << "Mapping file" << _url << "has no \"filename\" field";
|
|
||||||
finishedLoading(false);
|
finishedLoading(false);
|
||||||
} else {
|
} else {
|
||||||
QUrl url = _url.resolved(filename);
|
QUrl url = _url.resolved(filename);
|
||||||
|
@ -176,7 +175,6 @@ void GeometryReader::run() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!_resource.data()) {
|
if (!_resource.data()) {
|
||||||
qCWarning(modelnetworking) << "Abandoning load of" << _url << "; resource was deleted";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +239,6 @@ void GeometryReader::run() {
|
||||||
}
|
}
|
||||||
} catch (const QString& error) {
|
} catch (const QString& error) {
|
||||||
|
|
||||||
qCDebug(modelnetworking) << "Error parsing model for" << _url << ":" << error;
|
|
||||||
|
|
||||||
auto resource = _resource.toStrongRef();
|
auto resource = _resource.toStrongRef();
|
||||||
if (resource) {
|
if (resource) {
|
||||||
QMetaObject::invokeMethod(resource.data(), "finishedLoading",
|
QMetaObject::invokeMethod(resource.data(), "finishedLoading",
|
||||||
|
|
|
@ -576,7 +576,6 @@ bool NetworkTexture::handleFailedRequest(ResourceRequest::Result result) {
|
||||||
|
|
||||||
auto newPath = _request->getRelativePathUrl();
|
auto newPath = _request->getRelativePathUrl();
|
||||||
if (newPath.fileName().endsWith(".ktx")) {
|
if (newPath.fileName().endsWith(".ktx")) {
|
||||||
qDebug() << "Redirecting to" << newPath << "from" << _url;
|
|
||||||
_currentlyLoadingResourceType = ResourceType::KTX;
|
_currentlyLoadingResourceType = ResourceType::KTX;
|
||||||
_activeUrl = newPath;
|
_activeUrl = newPath;
|
||||||
_shouldFailOnRedirect = false;
|
_shouldFailOnRedirect = false;
|
||||||
|
@ -622,7 +621,6 @@ void NetworkTexture::startMipRangeRequest(uint16_t low, uint16_t high) {
|
||||||
this, _activeUrl, true, -1, "NetworkTexture::startMipRangeRequest");
|
this, _activeUrl, true, -1, "NetworkTexture::startMipRangeRequest");
|
||||||
|
|
||||||
if (!_ktxMipRequest) {
|
if (!_ktxMipRequest) {
|
||||||
qCWarning(networking).noquote() << "Failed to get request for" << _url.toDisplayString();
|
|
||||||
|
|
||||||
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID));
|
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID));
|
||||||
return;
|
return;
|
||||||
|
@ -681,12 +679,6 @@ void NetworkTexture::ktxInitialDataRequestFinished() {
|
||||||
|
|
||||||
if (result == ResourceRequest::Success) {
|
if (result == ResourceRequest::Success) {
|
||||||
|
|
||||||
// This is an expensive operation that we do not want in release.
|
|
||||||
#ifdef DEBUG
|
|
||||||
auto extraInfo = _url == _activeUrl ? "" : QString(", %1").arg(_activeUrl.toDisplayString());
|
|
||||||
qCDebug(networking).noquote() << QString("Request finished for %1%2").arg(_url.toDisplayString(), extraInfo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_ktxHeaderData = _ktxHeaderRequest->getData();
|
_ktxHeaderData = _ktxHeaderRequest->getData();
|
||||||
_ktxHighMipData = _ktxMipRequest->getData();
|
_ktxHighMipData = _ktxMipRequest->getData();
|
||||||
handleFinishedInitialLoad();
|
handleFinishedInitialLoad();
|
||||||
|
@ -731,8 +723,6 @@ void NetworkTexture::ktxMipRequestFinished() {
|
||||||
|
|
||||||
auto result = _ktxMipRequest->getResult();
|
auto result = _ktxMipRequest->getResult();
|
||||||
if (result == ResourceRequest::Success) {
|
if (result == ResourceRequest::Success) {
|
||||||
auto extraInfo = _url == _activeUrl ? "" : QString(", %1").arg(_activeUrl.toDisplayString());
|
|
||||||
qCDebug(networking).noquote() << QString("Request finished for %1%2").arg(_url.toDisplayString(), extraInfo);
|
|
||||||
|
|
||||||
if (_ktxResourceState == REQUESTING_MIP) {
|
if (_ktxResourceState == REQUESTING_MIP) {
|
||||||
Q_ASSERT(_ktxMipLevelRangeInFlight.first != NULL_MIP_LEVEL);
|
Q_ASSERT(_ktxMipLevelRangeInFlight.first != NULL_MIP_LEVEL);
|
||||||
|
@ -835,7 +825,6 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
||||||
auto header = reinterpret_cast<const ktx::Header*>(ktxHeaderData.data());
|
auto header = reinterpret_cast<const ktx::Header*>(ktxHeaderData.data());
|
||||||
|
|
||||||
if (!ktx::checkIdentifier(header->identifier)) {
|
if (!ktx::checkIdentifier(header->identifier)) {
|
||||||
qWarning() << "Cannot load " << url << ", invalid header identifier";
|
|
||||||
QMetaObject::invokeMethod(resource.data(), "setImage",
|
QMetaObject::invokeMethod(resource.data(), "setImage",
|
||||||
Q_ARG(gpu::TexturePointer, nullptr),
|
Q_ARG(gpu::TexturePointer, nullptr),
|
||||||
Q_ARG(int, 0),
|
Q_ARG(int, 0),
|
||||||
|
@ -845,7 +834,6 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
||||||
|
|
||||||
auto kvSize = header->bytesOfKeyValueData;
|
auto kvSize = header->bytesOfKeyValueData;
|
||||||
if (kvSize > (ktxHeaderData.size() - ktx::KTX_HEADER_SIZE)) {
|
if (kvSize > (ktxHeaderData.size() - ktx::KTX_HEADER_SIZE)) {
|
||||||
qWarning() << "Cannot load " << url << ", did not receive all kv data with initial request";
|
|
||||||
QMetaObject::invokeMethod(resource.data(), "setImage",
|
QMetaObject::invokeMethod(resource.data(), "setImage",
|
||||||
Q_ARG(gpu::TexturePointer, nullptr),
|
Q_ARG(gpu::TexturePointer, nullptr),
|
||||||
Q_ARG(int, 0),
|
Q_ARG(int, 0),
|
||||||
|
@ -857,7 +845,6 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
||||||
|
|
||||||
auto imageDescriptors = header->generateImageDescriptors();
|
auto imageDescriptors = header->generateImageDescriptors();
|
||||||
if (imageDescriptors.size() == 0) {
|
if (imageDescriptors.size() == 0) {
|
||||||
qWarning(networking) << "Failed to process ktx file " << url;
|
|
||||||
QMetaObject::invokeMethod(resource.data(), "setImage",
|
QMetaObject::invokeMethod(resource.data(), "setImage",
|
||||||
Q_ARG(gpu::TexturePointer, nullptr),
|
Q_ARG(gpu::TexturePointer, nullptr),
|
||||||
Q_ARG(int, 0),
|
Q_ARG(int, 0),
|
||||||
|
@ -987,7 +974,6 @@ void NetworkTexture::loadMetaContent(const QByteArray& content) {
|
||||||
|
|
||||||
TextureMeta meta;
|
TextureMeta meta;
|
||||||
if (!TextureMeta::deserialize(content, &meta)) {
|
if (!TextureMeta::deserialize(content, &meta)) {
|
||||||
qWarning() << "Failed to read texture meta from " << _url;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +985,6 @@ void NetworkTexture::loadMetaContent(const QByteArray& content) {
|
||||||
if (backend->supportedTextureFormat(elFormat)) {
|
if (backend->supportedTextureFormat(elFormat)) {
|
||||||
auto url = pair.second;
|
auto url = pair.second;
|
||||||
if (url.fileName().endsWith(TEXTURE_META_EXTENSION)) {
|
if (url.fileName().endsWith(TEXTURE_META_EXTENSION)) {
|
||||||
qWarning() << "Found a texture meta URL inside of the texture meta file at" << _activeUrl;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,7 +1029,6 @@ void NetworkTexture::loadMetaContent(const QByteArray& content) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning() << "Failed to find supported texture type in " << _activeUrl;
|
|
||||||
Resource::handleFailedRequest(ResourceRequest::NotFound);
|
Resource::handleFailedRequest(ResourceRequest::NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1135,7 +1119,6 @@ void ImageReader::run() {
|
||||||
void ImageReader::read() {
|
void ImageReader::read() {
|
||||||
auto resource = _resource.lock(); // to ensure the resource is still needed
|
auto resource = _resource.lock(); // to ensure the resource is still needed
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
qCWarning(modelnetworking) << "Abandoning load of" << _url << "; could not get strong ref";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto networkTexture = resource.staticCast<NetworkTexture>();
|
auto networkTexture = resource.staticCast<NetworkTexture>();
|
||||||
|
@ -1195,7 +1178,6 @@ void ImageReader::read() {
|
||||||
texture = image::processImage(std::move(buffer), _url.toString().toStdString(), _maxNumPixels, networkTexture->getTextureType(), shouldCompress, target);
|
texture = image::processImage(std::move(buffer), _url.toString().toStdString(), _maxNumPixels, networkTexture->getTextureType(), shouldCompress, target);
|
||||||
|
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
qCWarning(modelnetworking) << "Could not process:" << _url;
|
|
||||||
QMetaObject::invokeMethod(resource.data(), "setImage",
|
QMetaObject::invokeMethod(resource.data(), "setImage",
|
||||||
Q_ARG(gpu::TexturePointer, texture),
|
Q_ARG(gpu::TexturePointer, texture),
|
||||||
Q_ARG(int, 0),
|
Q_ARG(int, 0),
|
||||||
|
@ -1217,13 +1199,9 @@ void ImageReader::read() {
|
||||||
size_t length = memKtx->_storage->size();
|
size_t length = memKtx->_storage->size();
|
||||||
auto& ktxCache = textureCache->_ktxCache;
|
auto& ktxCache = textureCache->_ktxCache;
|
||||||
auto file = ktxCache->writeFile(data, KTXCache::Metadata(hash, length));
|
auto file = ktxCache->writeFile(data, KTXCache::Metadata(hash, length));
|
||||||
if (!file) {
|
if (file) {
|
||||||
qCWarning(modelnetworking) << _url << "file cache failed";
|
|
||||||
} else {
|
|
||||||
texture->setKtxBacking(file);
|
texture->setKtxBacking(file);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
qCWarning(modelnetworking) << "Unable to serialize texture to KTX " << _url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We replace the texture with the one stored in the cache. This deals with the possible race condition of two different
|
// We replace the texture with the one stored in the cache. This deals with the possible race condition of two different
|
||||||
|
|
|
@ -225,7 +225,6 @@ MiniPromise::Promise AssetClient::saveToCacheAsync(const QUrl& url, const QByteA
|
||||||
if (ioDevice) {
|
if (ioDevice) {
|
||||||
ioDevice->write(data);
|
ioDevice->write(data);
|
||||||
cache->insert(ioDevice);
|
cache->insert(ioDevice);
|
||||||
qCDebug(asset_client) << url.toDisplayString() << "saved to disk cache ("<< data.size()<<" bytes)";
|
|
||||||
deferred->resolve({
|
deferred->resolve({
|
||||||
{ "url", url },
|
{ "url", url },
|
||||||
{ "success", true },
|
{ "success", true },
|
||||||
|
@ -235,7 +234,7 @@ MiniPromise::Promise AssetClient::saveToCacheAsync(const QUrl& url, const QByteA
|
||||||
{ "lastModified", metaData.lastModified().toString().isEmpty() ? QDateTime() : metaData.lastModified() },
|
{ "lastModified", metaData.lastModified().toString().isEmpty() ? QDateTime() : metaData.lastModified() },
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
auto error = QString("Could not save %1 to disk cache").arg(url.toDisplayString());
|
auto error = QString("Could not save to disk cache");
|
||||||
qCWarning(asset_client) << error;
|
qCWarning(asset_client) << error;
|
||||||
deferred->reject(CACHE_ERROR_MESSAGE.arg(__FUNCTION__).arg(error));
|
deferred->reject(CACHE_ERROR_MESSAGE.arg(__FUNCTION__).arg(error));
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,9 +218,6 @@ void AssetResourceRequest::onDownloadProgress(qint64 bytesReceived, qint64 bytes
|
||||||
|
|
||||||
int percentage = roundf((float) bytesReceived / (float) bytesTotal * 100.0f);
|
int percentage = roundf((float) bytesReceived / (float) bytesTotal * 100.0f);
|
||||||
|
|
||||||
qCDebug(networking).nospace() << "Progress for " << _url.path() << " - "
|
|
||||||
<< bytesReceived << " of " << bytesTotal << " bytes - " << percentage << "%";
|
|
||||||
|
|
||||||
_lastProgressDebug = now;
|
_lastProgressDebug = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,10 +76,6 @@ void AssetUpload::start() {
|
||||||
|
|
||||||
// ask the AssetClient to upload the asset and emit the proper signals from the passed callback
|
// ask the AssetClient to upload the asset and emit the proper signals from the passed callback
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
|
|
||||||
if (!_filename.isEmpty()) {
|
|
||||||
qCDebug(asset_client) << "Attempting to upload" << _filename << "to asset-server.";
|
|
||||||
}
|
|
||||||
|
|
||||||
assetClient->uploadAsset(_data, [this](bool responseReceived, AssetUtils::AssetServerError error, const QString& hash){
|
assetClient->uploadAsset(_data, [this](bool responseReceived, AssetUtils::AssetServerError error, const QString& hash){
|
||||||
if (!responseReceived) {
|
if (!responseReceived) {
|
||||||
|
|
|
@ -67,10 +67,7 @@ QByteArray loadFromCache(const QUrl& url) {
|
||||||
|
|
||||||
// caller is responsible for the deletion of the ioDevice, hence the unique_ptr
|
// caller is responsible for the deletion of the ioDevice, hence the unique_ptr
|
||||||
if (auto ioDevice = std::unique_ptr<QIODevice>(cache->data(url))) {
|
if (auto ioDevice = std::unique_ptr<QIODevice>(cache->data(url))) {
|
||||||
qCDebug(asset_client) << url.toDisplayString() << "loaded from disk cache.";
|
|
||||||
return ioDevice->readAll();
|
return ioDevice->readAll();
|
||||||
} else {
|
|
||||||
qCDebug(asset_client) << url.toDisplayString() << "not in disk cache";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,10 +88,8 @@ bool saveToCache(const QUrl& url, const QByteArray& file) {
|
||||||
if (auto ioDevice = cache->prepare(metaData)) {
|
if (auto ioDevice = cache->prepare(metaData)) {
|
||||||
ioDevice->write(file);
|
ioDevice->write(file);
|
||||||
cache->insert(ioDevice);
|
cache->insert(ioDevice);
|
||||||
qCDebug(asset_client) << url.toDisplayString() << "saved to disk cache";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
qCWarning(asset_client) << "Could not save" << url.toDisplayString() << "to disk cache.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,6 @@ void FileResourceRequest::doSend() {
|
||||||
QFileSelector fileSelector;
|
QFileSelector fileSelector;
|
||||||
fileSelector.setExtraSelectors(FileUtils::getFileSelectors());
|
fileSelector.setExtraSelectors(FileUtils::getFileSelectors());
|
||||||
filename = fileSelector.select(filename);
|
filename = fileSelector.select(filename);
|
||||||
if (filename != originalFilename) {
|
|
||||||
qCDebug(resourceLog) << "Using" << filename << "instead of" << originalFilename;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_byteRange.isValid()) {
|
if (!_byteRange.isValid()) {
|
||||||
|
|
|
@ -208,7 +208,7 @@ void HTTPResourceRequest::onDownloadProgress(qint64 bytesReceived, qint64 bytesT
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPResourceRequest::onTimeout() {
|
void HTTPResourceRequest::onTimeout() {
|
||||||
qDebug() << "Timeout: " << _url << ":" << _reply->isFinished();
|
qDebug() << "Timeout: " << _reply->isFinished();
|
||||||
Q_ASSERT(_state == InProgress);
|
Q_ASSERT(_state == InProgress);
|
||||||
_reply->disconnect(this);
|
_reply->disconnect(this);
|
||||||
_reply->abort();
|
_reply->abort();
|
||||||
|
|
|
@ -96,9 +96,6 @@ void GetMappingRequest::doStart() {
|
||||||
// if it did grab that re-directed path
|
// if it did grab that re-directed path
|
||||||
if (_wasRedirected) {
|
if (_wasRedirected) {
|
||||||
_redirectedPath = message->readString();
|
_redirectedPath = message->readString();
|
||||||
qDebug() << "Got redirected from " << _path << " to " << _redirectedPath;
|
|
||||||
} else {
|
|
||||||
qDebug() << "Not redirected: " << _path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,7 @@ void Resource::attemptRequest() {
|
||||||
_startedLoading = true;
|
_startedLoading = true;
|
||||||
|
|
||||||
if (_attempts > 0) {
|
if (_attempts > 0) {
|
||||||
qCDebug(networking).noquote() << "Server unavailable for" << _url
|
qCDebug(networking).noquote() << "Server unavailable "
|
||||||
<< "- retrying asset load - attempt" << _attempts << " of " << MAX_ATTEMPTS;
|
<< "- retrying asset load - attempt" << _attempts << " of " << MAX_ATTEMPTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,11 +658,9 @@ void Resource::attemptRequest() {
|
||||||
|
|
||||||
void Resource::finishedLoading(bool success) {
|
void Resource::finishedLoading(bool success) {
|
||||||
if (success) {
|
if (success) {
|
||||||
qCDebug(networking).noquote() << "Finished loading:" << _url.toDisplayString();
|
|
||||||
_loadPriorities.clear();
|
_loadPriorities.clear();
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
} else {
|
} else {
|
||||||
qCDebug(networking).noquote() << "Failed to load:" << _url.toDisplayString();
|
|
||||||
_failedToLoad = true;
|
_failedToLoad = true;
|
||||||
}
|
}
|
||||||
emit finished(success);
|
emit finished(success);
|
||||||
|
@ -692,7 +690,6 @@ void Resource::makeRequest() {
|
||||||
this, _activeUrl, true, -1, "Resource::makeRequest");
|
this, _activeUrl, true, -1, "Resource::makeRequest");
|
||||||
|
|
||||||
if (!_request) {
|
if (!_request) {
|
||||||
qCDebug(networking).noquote() << "Failed to get request for" << _url.toDisplayString();
|
|
||||||
ResourceCache::requestCompleted(_self);
|
ResourceCache::requestCompleted(_self);
|
||||||
finishedLoading(false);
|
finishedLoading(false);
|
||||||
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID));
|
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID));
|
||||||
|
@ -744,8 +741,6 @@ void Resource::handleReplyFinished() {
|
||||||
|
|
||||||
auto result = _request->getResult();
|
auto result = _request->getResult();
|
||||||
if (result == ResourceRequest::Success) {
|
if (result == ResourceRequest::Success) {
|
||||||
auto extraInfo = _url == _activeUrl ? "" : QString(", %1").arg(_activeUrl.toDisplayString());
|
|
||||||
qCDebug(networking).noquote() << QString("Request finished for %1%2").arg(_activeUrl.toDisplayString(), extraInfo);
|
|
||||||
|
|
||||||
auto relativePathURL = _request->getRelativePathUrl();
|
auto relativePathURL = _request->getRelativePathUrl();
|
||||||
if (!relativePathURL.isEmpty()) {
|
if (!relativePathURL.isEmpty()) {
|
||||||
|
@ -768,7 +763,7 @@ bool Resource::handleFailedRequest(ResourceRequest::Result result) {
|
||||||
bool willRetry = false;
|
bool willRetry = false;
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case ResourceRequest::Result::Timeout: {
|
case ResourceRequest::Result::Timeout: {
|
||||||
qCDebug(networking) << "Timed out loading" << _url << "received" << _bytesReceived << "total" << _bytesTotal;
|
qCDebug(networking) << "Timed out, received" << _bytesReceived << "total" << _bytesTotal;
|
||||||
// Fall through to other cases
|
// Fall through to other cases
|
||||||
}
|
}
|
||||||
// FALLTHRU
|
// FALLTHRU
|
||||||
|
@ -776,13 +771,13 @@ bool Resource::handleFailedRequest(ResourceRequest::Result result) {
|
||||||
_attempts++;
|
_attempts++;
|
||||||
_attemptsRemaining--;
|
_attemptsRemaining--;
|
||||||
|
|
||||||
qCDebug(networking) << "Retryable error while loading" << _url << "attempt:" << _attempts << "attemptsRemaining:" << _attemptsRemaining;
|
qCDebug(networking) << "Retryable error while loading: attempt:" << _attempts << "attemptsRemaining:" << _attemptsRemaining;
|
||||||
|
|
||||||
// retry with increasing delays
|
// retry with increasing delays
|
||||||
const int BASE_DELAY_MS = 1000;
|
const int BASE_DELAY_MS = 1000;
|
||||||
if (_attempts < MAX_ATTEMPTS) {
|
if (_attempts < MAX_ATTEMPTS) {
|
||||||
auto waitTime = BASE_DELAY_MS * (int)pow(2.0, _attempts);
|
auto waitTime = BASE_DELAY_MS * (int)pow(2.0, _attempts);
|
||||||
qCDebug(networking).noquote() << "Server unavailable for" << _url << "- may retry in" << waitTime << "ms"
|
qCDebug(networking).noquote() << "Server unavailable for - may retry in" << waitTime << "ms"
|
||||||
<< "if resource is still needed";
|
<< "if resource is still needed";
|
||||||
QTimer::singleShot(waitTime, this, &Resource::attemptRequest);
|
QTimer::singleShot(waitTime, this, &Resource::attemptRequest);
|
||||||
willRetry = true;
|
willRetry = true;
|
||||||
|
@ -793,7 +788,7 @@ bool Resource::handleFailedRequest(ResourceRequest::Result result) {
|
||||||
// FALLTHRU
|
// FALLTHRU
|
||||||
default: {
|
default: {
|
||||||
_attemptsRemaining = 0;
|
_attemptsRemaining = 0;
|
||||||
qCDebug(networking) << "Error loading " << _url << "attempt:" << _attempts << "attemptsRemaining:" << _attemptsRemaining;
|
qCDebug(networking) << "Error loading, attempt:" << _attempts << "attemptsRemaining:" << _attemptsRemaining;
|
||||||
auto error = (result == ResourceRequest::Timeout) ? QNetworkReply::TimeoutError
|
auto error = (result == ResourceRequest::Timeout) ? QNetworkReply::TimeoutError
|
||||||
: QNetworkReply::UnknownNetworkError;
|
: QNetworkReply::UnknownNetworkError;
|
||||||
emit failed(error);
|
emit failed(error);
|
||||||
|
|
|
@ -679,7 +679,6 @@ bool Octree::readFromFile(const char* fileName) {
|
||||||
QFile file(qFileName);
|
QFile file(qFileName);
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
qCritical() << "unable to open for reading: " << fileName;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,8 +686,6 @@ bool Octree::readFromFile(const char* fileName) {
|
||||||
QFileInfo fileInfo(qFileName);
|
QFileInfo fileInfo(qFileName);
|
||||||
uint64_t fileLength = fileInfo.size();
|
uint64_t fileLength = fileInfo.size();
|
||||||
|
|
||||||
qCDebug(octree) << "Loading file" << qFileName << "...";
|
|
||||||
|
|
||||||
bool success = readFromStream(fileLength, fileInputStream);
|
bool success = readFromStream(fileLength, fileInputStream);
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -699,14 +696,12 @@ bool Octree::readFromFile(const char* fileName) {
|
||||||
bool Octree::readJSONFromGzippedFile(QString qFileName) {
|
bool Octree::readJSONFromGzippedFile(QString qFileName) {
|
||||||
QFile file(qFileName);
|
QFile file(qFileName);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
qCritical() << "Cannot open gzipped json file for reading: " << qFileName;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QByteArray compressedJsonData = file.readAll();
|
QByteArray compressedJsonData = file.readAll();
|
||||||
QByteArray jsonData;
|
QByteArray jsonData;
|
||||||
|
|
||||||
if (!gunzip(compressedJsonData, jsonData)) {
|
if (!gunzip(compressedJsonData, jsonData)) {
|
||||||
qCritical() << "json File not in gzip format: " << qFileName;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
bool readOctreeFile(QString path, QJsonDocument* doc) {
|
bool readOctreeFile(QString path, QJsonDocument* doc) {
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
qCritical() << "Cannot open json file for reading: " << path;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,6 @@ void OctreePersistThread::handleOctreeDataFileReply(QSharedPointer<ReceivedMessa
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 loadStarted = usecTimestampNow();
|
quint64 loadStarted = usecTimestampNow();
|
||||||
qCDebug(octree) << "loading Octrees from file: " << _filename << "...";
|
|
||||||
|
|
||||||
if (hasValidOctreeData) {
|
if (hasValidOctreeData) {
|
||||||
qDebug() << "Setting entity version info to: " << data.id << data.version;
|
qDebug() << "Setting entity version info to: " << data.id << data.version;
|
||||||
|
@ -147,7 +146,6 @@ void OctreePersistThread::handleOctreeDataFileReply(QSharedPointer<ReceivedMessa
|
||||||
_loadTimeUSecs = loadDone - loadStarted;
|
_loadTimeUSecs = loadDone - loadStarted;
|
||||||
|
|
||||||
_tree->clearDirtyBit(); // the tree is clean since we just loaded it
|
_tree->clearDirtyBit(); // the tree is clean since we just loaded it
|
||||||
qCDebug(octree, "DONE loading Octrees from file... fileRead=%s", debug::valueOf(persistentFileRead));
|
|
||||||
|
|
||||||
unsigned long nodeCount = OctreeElement::getNodeCount();
|
unsigned long nodeCount = OctreeElement::getNodeCount();
|
||||||
unsigned long internalNodeCount = OctreeElement::getInternalNodeCount();
|
unsigned long internalNodeCount = OctreeElement::getInternalNodeCount();
|
||||||
|
|
|
@ -157,13 +157,11 @@ void Procedural::setProceduralData(const ProceduralData& proceduralData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shaderUrl.isValid()) {
|
if (!shaderUrl.isValid()) {
|
||||||
qCWarning(proceduralLog) << "Invalid shader URL: " << shaderUrl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shaderUrl.isLocalFile()) {
|
if (shaderUrl.isLocalFile()) {
|
||||||
if (!QFileInfo(shaderUrl.toLocalFile()).exists()) {
|
if (!QFileInfo(shaderUrl.toLocalFile()).exists()) {
|
||||||
qCWarning(proceduralLog) << "Invalid shader URL, missing local file: " << shaderUrl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_shaderPath = shaderUrl.toLocalFile();
|
_shaderPath = shaderUrl.toLocalFile();
|
||||||
|
|
|
@ -398,7 +398,6 @@ void AssetScriptingInterface::loadFromCache(QScriptValue options, QScriptValue s
|
||||||
bool AssetScriptingInterface::canWriteCacheValue(const QUrl& url) {
|
bool AssetScriptingInterface::canWriteCacheValue(const QUrl& url) {
|
||||||
auto scriptEngine = qobject_cast<ScriptEngine*>(engine());
|
auto scriptEngine = qobject_cast<ScriptEngine*>(engine());
|
||||||
if (!scriptEngine) {
|
if (!scriptEngine) {
|
||||||
qCDebug(scriptengine) << __FUNCTION__ << "invalid script engine" << url;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// allow cache writes only from Client, EntityServer and Agent scripts
|
// allow cache writes only from Client, EntityServer and Agent scripts
|
||||||
|
@ -407,7 +406,6 @@ bool AssetScriptingInterface::canWriteCacheValue(const QUrl& url) {
|
||||||
scriptEngine->isAgentScript()
|
scriptEngine->isAgentScript()
|
||||||
);
|
);
|
||||||
if (!isAllowedContext) {
|
if (!isAllowedContext) {
|
||||||
qCDebug(scriptengine) << __FUNCTION__ << "invalid context" << scriptEngine->getContext() << url;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -430,7 +428,6 @@ void AssetScriptingInterface::saveToCache(const QUrl& rawURL, const QByteArray&
|
||||||
auto atpURL = AssetUtils::getATPUrl(hashDataHex(data));
|
auto atpURL = AssetUtils::getATPUrl(hashDataHex(data));
|
||||||
atpURL.setQuery(url.query());
|
atpURL.setQuery(url.query());
|
||||||
atpURL.setFragment(url.fragment());
|
atpURL.setFragment(url.fragment());
|
||||||
qCDebug(scriptengine) << "autogenerated ATP URL" << url << "=>" << atpURL;
|
|
||||||
url = atpURL;
|
url = atpURL;
|
||||||
}
|
}
|
||||||
auto hash = AssetUtils::extractAssetHash(url.toDisplayString());
|
auto hash = AssetUtils::extractAssetHash(url.toDisplayString());
|
||||||
|
@ -440,7 +437,6 @@ void AssetScriptingInterface::saveToCache(const QUrl& rawURL, const QByteArray&
|
||||||
JS_VERIFY(url.scheme() == "atp" || url.scheme() == "cache", "only 'atp' and 'cache' URL schemes supported");
|
JS_VERIFY(url.scheme() == "atp" || url.scheme() == "cache", "only 'atp' and 'cache' URL schemes supported");
|
||||||
JS_VERIFY(hash.isEmpty() || hash == hashDataHex(data), QString("invalid checksum hash for atp:HASH style URL (%1 != %2)").arg(hash, hashDataHex(data)));
|
JS_VERIFY(hash.isEmpty() || hash == hashDataHex(data), QString("invalid checksum hash for atp:HASH style URL (%1 != %2)").arg(hash, hashDataHex(data)));
|
||||||
|
|
||||||
// qCDebug(scriptengine) << "saveToCache" << url.toDisplayString() << data << hash << metadata;
|
|
||||||
|
|
||||||
jsPromiseReady(Parent::saveToCache(url, data, metadata), scope, callback);
|
jsPromiseReady(Parent::saveToCache(url, data, metadata), scope, callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,6 @@ void BatchLoader::start(int maxRetries) {
|
||||||
for (const auto& rawURL : _urls) {
|
for (const auto& rawURL : _urls) {
|
||||||
QUrl url = expandScriptUrl(normalizeScriptURL(rawURL));
|
QUrl url = expandScriptUrl(normalizeScriptURL(rawURL));
|
||||||
|
|
||||||
qCDebug(scriptengine) << "Loading script at " << url;
|
|
||||||
|
|
||||||
auto scriptCache = DependencyManager::get<ScriptCache>();
|
auto scriptCache = DependencyManager::get<ScriptCache>();
|
||||||
|
|
||||||
// Use a proxy callback to handle the call and emit the signal in a thread-safe way.
|
// Use a proxy callback to handle the call and emit the signal in a thread-safe way.
|
||||||
|
@ -65,10 +63,8 @@ void BatchLoader::start(int maxRetries) {
|
||||||
_status.insert(url, status);
|
_status.insert(url, status);
|
||||||
if (isURL && success) {
|
if (isURL && success) {
|
||||||
_data.insert(url, contents);
|
_data.insert(url, contents);
|
||||||
qCDebug(scriptengine) << "Loaded: " << url;
|
|
||||||
} else {
|
} else {
|
||||||
_data.insert(url, QString());
|
_data.insert(url, QString());
|
||||||
qCDebug(scriptengine) << "Could not load: " << url << status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_finished && _urls.size() == _data.size()) {
|
if (!_finished && _urls.size() == _data.size()) {
|
||||||
|
|
|
@ -38,10 +38,7 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip, bool isBlocks) {
|
void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip, bool isBlocks) {
|
||||||
qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
|
|
||||||
qCDebug(scriptengine) << "Path where download is saved: " + path;
|
|
||||||
QString fileName = "/" + path.section("/", -1);
|
QString fileName = "/" + path.section("/", -1);
|
||||||
qCDebug(scriptengine) << "Filename: " << fileName;
|
|
||||||
QString tempDir = path;
|
QString tempDir = path;
|
||||||
if (!isZip) {
|
if (!isZip) {
|
||||||
tempDir.remove(fileName);
|
tempDir.remove(fileName);
|
||||||
|
@ -59,9 +56,7 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
|
||||||
|
|
||||||
QStringList fileList = unzipFile(path, tempDir);
|
QStringList fileList = unzipFile(path, tempDir);
|
||||||
|
|
||||||
if (!fileList.isEmpty()) {
|
if(fileList.isEmpty()) {
|
||||||
qCDebug(scriptengine) << "First file to upload: " + fileList.first();
|
|
||||||
} else {
|
|
||||||
qCDebug(scriptengine) << "Unzip failed";
|
qCDebug(scriptengine) << "Unzip failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +126,6 @@ QString FileScriptingInterface::convertUrlToPath(QUrl url) {
|
||||||
QString newUrl;
|
QString newUrl;
|
||||||
QString oldUrl = url.toString();
|
QString oldUrl = url.toString();
|
||||||
newUrl = oldUrl.section("filename=", 1, 1);
|
newUrl = oldUrl.section("filename=", 1, 1);
|
||||||
qCDebug(scriptengine) << "Filename should be: " + newUrl;
|
|
||||||
return newUrl;
|
return newUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,14 +143,12 @@ void FileScriptingInterface::downloadZip(QString path, const QString link) {
|
||||||
// this function is not in use
|
// this function is not in use
|
||||||
void FileScriptingInterface::recursiveFileScan(QFileInfo file, QString* dirName) {
|
void FileScriptingInterface::recursiveFileScan(QFileInfo file, QString* dirName) {
|
||||||
/*if (!file.isDir()) {
|
/*if (!file.isDir()) {
|
||||||
qCDebug(scriptengine) << "Regular file logged: " + file.fileName();
|
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
QFileInfoList files;
|
QFileInfoList files;
|
||||||
// FIXME quazip hasn't been built on the android toolchain
|
// FIXME quazip hasn't been built on the android toolchain
|
||||||
#if !defined(Q_OS_ANDROID)
|
#if !defined(Q_OS_ANDROID)
|
||||||
if (file.fileName().contains(".zip")) {
|
if (file.fileName().contains(".zip")) {
|
||||||
qCDebug(scriptengine) << "Extracting archive: " + file.fileName();
|
|
||||||
JlCompress::extractDir(file.fileName());
|
JlCompress::extractDir(file.fileName());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -167,7 +159,6 @@ void FileScriptingInterface::recursiveFileScan(QFileInfo file, QString* dirName)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
foreach (QFileInfo file, files) {
|
foreach (QFileInfo file, files) {
|
||||||
qCDebug(scriptengine) << "Looking into file: " + file.fileName();
|
|
||||||
recursiveFileScan(file, dirName);
|
recursiveFileScan(file, dirName);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,9 +37,6 @@ ScriptCache::ScriptCache(QObject* parent) {
|
||||||
|
|
||||||
void ScriptCache::clearCache() {
|
void ScriptCache::clearCache() {
|
||||||
Lock lock(_containerLock);
|
Lock lock(_containerLock);
|
||||||
foreach(auto& url, _scriptCache.keys()) {
|
|
||||||
qCDebug(scriptengine) << "clearing cache: " << url;
|
|
||||||
}
|
|
||||||
_scriptCache.clear();
|
_scriptCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +45,6 @@ void ScriptCache::clearATPScriptsFromCache() {
|
||||||
qCDebug(scriptengine) << "Clearing ATP scripts from ScriptCache";
|
qCDebug(scriptengine) << "Clearing ATP scripts from ScriptCache";
|
||||||
for (auto it = _scriptCache.begin(); it != _scriptCache.end();) {
|
for (auto it = _scriptCache.begin(); it != _scriptCache.end();) {
|
||||||
if (it.key().scheme() == "atp") {
|
if (it.key().scheme() == "atp") {
|
||||||
qCDebug(scriptengine) << "Removing: " << it.key();
|
|
||||||
it = _scriptCache.erase(it);
|
it = _scriptCache.erase(it);
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
|
@ -60,7 +56,6 @@ void ScriptCache::deleteScript(const QUrl& unnormalizedURL) {
|
||||||
QUrl url = DependencyManager::get<ResourceManager>()->normalizeURL(unnormalizedURL);
|
QUrl url = DependencyManager::get<ResourceManager>()->normalizeURL(unnormalizedURL);
|
||||||
Lock lock(_containerLock);
|
Lock lock(_containerLock);
|
||||||
if (_scriptCache.contains(url)) {
|
if (_scriptCache.contains(url)) {
|
||||||
qCDebug(scriptengine) << "Delete script from cache:" << url.toString();
|
|
||||||
_scriptCache.remove(url);
|
_scriptCache.remove(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +141,6 @@ void ScriptCache::scriptContentAvailable(int maxRetries) {
|
||||||
_activeScriptRequests.remove(url);
|
_activeScriptRequests.remove(url);
|
||||||
|
|
||||||
_scriptCache[url] = scriptContent = req->getData();
|
_scriptCache[url] = scriptContent = req->getData();
|
||||||
qCDebug(scriptengine) << "Done downloading script at:" << url.toString();
|
|
||||||
} else {
|
} else {
|
||||||
auto result = req->getResult();
|
auto result = req->getResult();
|
||||||
bool irrecoverable =
|
bool irrecoverable =
|
||||||
|
@ -160,12 +154,12 @@ void ScriptCache::scriptContentAvailable(int maxRetries) {
|
||||||
|
|
||||||
int timeout = exp(scriptRequest.numRetries) * ScriptRequest::START_DELAY_BETWEEN_RETRIES;
|
int timeout = exp(scriptRequest.numRetries) * ScriptRequest::START_DELAY_BETWEEN_RETRIES;
|
||||||
int attempt = scriptRequest.numRetries;
|
int attempt = scriptRequest.numRetries;
|
||||||
qCDebug(scriptengine) << QString("Script request failed [%1]: %2 (will retry %3 more times; attempt #%4 in %5ms...)")
|
qCDebug(scriptengine) << QString("Script request failed [%1]: (will retry %2 more times; attempt #%3 in %4ms...)")
|
||||||
.arg(status).arg(url.toString()).arg(maxRetries - attempt + 1).arg(attempt).arg(timeout);
|
.arg(status).arg(maxRetries - attempt + 1).arg(attempt).arg(timeout);
|
||||||
|
|
||||||
QTimer::singleShot(timeout, this, [this, url, attempt, maxRetries]() {
|
QTimer::singleShot(timeout, this, [this, url, attempt, maxRetries]() {
|
||||||
qCDebug(scriptengine) << QString("Retrying script request [%1 / %2]: %3")
|
qCDebug(scriptengine) << QString("Retrying script request [%1 / %2]")
|
||||||
.arg(attempt).arg(maxRetries).arg(url.toString());
|
.arg(attempt).arg(maxRetries);
|
||||||
|
|
||||||
auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(
|
auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(
|
||||||
nullptr, url, true, -1, "ScriptCache::scriptContentAvailable");
|
nullptr, url, true, -1, "ScriptCache::scriptContentAvailable");
|
||||||
|
@ -186,12 +180,10 @@ void ScriptCache::scriptContentAvailable(int maxRetries) {
|
||||||
scriptContent = _scriptCache[url];
|
scriptContent = _scriptCache[url];
|
||||||
}
|
}
|
||||||
_activeScriptRequests.remove(url);
|
_activeScriptRequests.remove(url);
|
||||||
qCWarning(scriptengine) << "Error loading script from URL " << url << "(" << status <<")";
|
qCWarning(scriptengine) << "Error loading script from URL (" << status <<")";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
qCWarning(scriptengine) << "Warning: scriptContentAvailable for inactive url: " << url;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,6 @@ void ScriptEngine::runInThread() {
|
||||||
Q_ASSERT_X(!_isThreaded, "ScriptEngine::runInThread()", "runInThread should not be called more than once");
|
Q_ASSERT_X(!_isThreaded, "ScriptEngine::runInThread()", "runInThread should not be called more than once");
|
||||||
|
|
||||||
if (_isThreaded) {
|
if (_isThreaded) {
|
||||||
qCWarning(scriptengine) << "ScriptEngine already running in thread: " << getFilename();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,10 +418,10 @@ void ScriptEngine::waitTillDoneRunning() {
|
||||||
workerThread->quit();
|
workerThread->quit();
|
||||||
|
|
||||||
if (isEvaluating()) {
|
if (isEvaluating()) {
|
||||||
qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename();
|
qCWarning(scriptengine) << "Script Engine has been running too long, aborting.";
|
||||||
abortEvaluation();
|
abortEvaluation();
|
||||||
} else {
|
} else {
|
||||||
qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename();
|
qCWarning(scriptengine) << "Script Engine has been running too long, throwing.";
|
||||||
auto context = currentContext();
|
auto context = currentContext();
|
||||||
if (context) {
|
if (context) {
|
||||||
context->throwError("Timed out during shutdown");
|
context->throwError("Timed out during shutdown");
|
||||||
|
@ -498,7 +497,6 @@ void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) {
|
||||||
{
|
{
|
||||||
static const QString DEBUG_FLAG("#debug");
|
static const QString DEBUG_FLAG("#debug");
|
||||||
if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) {
|
if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) {
|
||||||
qCWarning(scriptengine) << "NOTE: ScriptEngine for " << QUrl(url).fileName() << " will be launched in debug mode";
|
|
||||||
_debuggable = true;
|
_debuggable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1632,7 +1630,6 @@ QVariantMap ScriptEngine::fetchModuleSource(const QString& modulePath, const boo
|
||||||
auto url = modulePath;
|
auto url = modulePath;
|
||||||
auto status = _status[url];
|
auto status = _status[url];
|
||||||
auto contents = data[url];
|
auto contents = data[url];
|
||||||
qCDebug(scriptengine_module) << "require.fetchModuleSource.onload: " << QUrl(url).fileName() << status << QThread::currentThread();
|
|
||||||
if (isStopping()) {
|
if (isStopping()) {
|
||||||
req["status"] = "Stopped";
|
req["status"] = "Stopped";
|
||||||
req["success"] = false;
|
req["success"] = false;
|
||||||
|
@ -1752,8 +1749,8 @@ QScriptValue ScriptEngine::require(const QString& moduleId) {
|
||||||
auto exports = module.property("exports");
|
auto exports = module.property("exports");
|
||||||
if (!invalidateCache && exports.isObject()) {
|
if (!invalidateCache && exports.isObject()) {
|
||||||
// we have found a cached module -- just need to possibly register it with current parent
|
// we have found a cached module -- just need to possibly register it with current parent
|
||||||
qCDebug(scriptengine_module) << QString("require - using cached module '%1' for '%2' (loaded: %3)")
|
qCDebug(scriptengine_module) << QString("require - using cached module for '%1' (loaded: %2)")
|
||||||
.arg(modulePath).arg(moduleId).arg(module.property("loaded").toString());
|
.arg(moduleId).arg(module.property("loaded").toString());
|
||||||
registerModuleWithParent(module, parent);
|
registerModuleWithParent(module, parent);
|
||||||
maybeEmitUncaughtException("cached module");
|
maybeEmitUncaughtException("cached module");
|
||||||
return exports;
|
return exports;
|
||||||
|
@ -2138,7 +2135,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString&
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
|
|
||||||
if (isStopping() || DependencyManager::get<ScriptEngines>()->isStopped()) {
|
if (isStopping() || DependencyManager::get<ScriptEngines>()->isStopped()) {
|
||||||
qCDebug(scriptengine) << "loadEntityScript.start " << entityScript << entityID.toString()
|
qCDebug(scriptengine) << "loadEntityScript.start " << entityID.toString()
|
||||||
<< " but isStopping==" << isStopping()
|
<< " but isStopping==" << isStopping()
|
||||||
<< " || engines->isStopped==" << DependencyManager::get<ScriptEngines>()->isStopped();
|
<< " || engines->isStopped==" << DependencyManager::get<ScriptEngines>()->isStopped();
|
||||||
return;
|
return;
|
||||||
|
@ -2163,8 +2160,8 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString&
|
||||||
// since not reloading, assume that the exact same input would produce the exact same output again
|
// since not reloading, assume that the exact same input would produce the exact same output again
|
||||||
// note: this state gets reset with "reload all scripts," leaving/returning to a Domain, clear cache, etc.
|
// note: this state gets reset with "reload all scripts," leaving/returning to a Domain, clear cache, etc.
|
||||||
#ifdef DEBUG_ENTITY_STATES
|
#ifdef DEBUG_ENTITY_STATES
|
||||||
qCDebug(scriptengine) << QString("loadEntityScript.cancelled entity: %1 script: %2 (previous script failure)")
|
qCDebug(scriptengine) << QString("loadEntityScript.cancelled entity: %1 (previous script failure)")
|
||||||
.arg(entityID.toString()).arg(entityScript);
|
.arg(entityID.toString());
|
||||||
#endif
|
#endif
|
||||||
updateEntityScriptStatus(entityID, EntityScriptStatus::ERROR_LOADING_SCRIPT,
|
updateEntityScriptStatus(entityID, EntityScriptStatus::ERROR_LOADING_SCRIPT,
|
||||||
"A previous Entity failed to load using this script URL; reload to try again.");
|
"A previous Entity failed to load using this script URL; reload to try again.");
|
||||||
|
@ -2173,8 +2170,8 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString&
|
||||||
} else {
|
} else {
|
||||||
// another entity is busy loading from this script URL so wait for them to finish
|
// another entity is busy loading from this script URL so wait for them to finish
|
||||||
#ifdef DEBUG_ENTITY_STATES
|
#ifdef DEBUG_ENTITY_STATES
|
||||||
qCDebug(scriptengine) << QString("loadEntityScript.deferring[%0] entity: %1 script: %2 (waiting on %3)")
|
qCDebug(scriptengine) << QString("loadEntityScript.deferring[%0] entity: %1 (waiting on %2 )")
|
||||||
.arg(_deferredEntityLoads.size()).arg(entityID.toString()).arg(entityScript).arg(currentEntityID.toString());
|
.arg(_deferredEntityLoads.size()).arg(entityID.toString()).arg(currentEntityID.toString());
|
||||||
#endif
|
#endif
|
||||||
_deferredEntityLoads.push_back({ entityID, entityScript });
|
_deferredEntityLoads.push_back({ entityID, entityScript });
|
||||||
return;
|
return;
|
||||||
|
@ -2188,7 +2185,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString&
|
||||||
{
|
{
|
||||||
EntityScriptDetails details;
|
EntityScriptDetails details;
|
||||||
bool hasEntityScript = getEntityScriptDetails(entityID, details);
|
bool hasEntityScript = getEntityScriptDetails(entityID, details);
|
||||||
qCDebug(scriptengine) << "loadEntityScript.LOADING: " << entityScript << entityID.toString()
|
qCDebug(scriptengine) << "loadEntityScript.LOADING: " << entityID.toString()
|
||||||
<< "(previous: " << (hasEntityScript ? details.status : EntityScriptStatus::PENDING) << ")";
|
<< "(previous: " << (hasEntityScript ? details.status : EntityScriptStatus::PENDING) << ")";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2217,7 +2214,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString&
|
||||||
}
|
}
|
||||||
executeOnScriptThread([=]{
|
executeOnScriptThread([=]{
|
||||||
#ifdef DEBUG_ENTITY_STATES
|
#ifdef DEBUG_ENTITY_STATES
|
||||||
qCDebug(scriptengine) << "loadEntityScript.contentAvailable" << status << QUrl(url).fileName() << entityID.toString();
|
qCDebug(scriptengine) << "loadEntityScript.contentAvailable" << status << entityID.toString();
|
||||||
#endif
|
#endif
|
||||||
if (!isStopping() && hasEntityScriptDetails(entityID)) {
|
if (!isStopping() && hasEntityScriptDetails(entityID)) {
|
||||||
_contentAvailableQueue[entityID] = { entityID, url, contents, isURL, success, status };
|
_contentAvailableQueue[entityID] = { entityID, url, contents, isURL, success, status };
|
||||||
|
@ -2306,7 +2303,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
||||||
setEntityScriptDetails(entityID, newDetails);
|
setEntityScriptDetails(entityID, newDetails);
|
||||||
|
|
||||||
#ifdef DEBUG_ENTITY_STATES
|
#ifdef DEBUG_ENTITY_STATES
|
||||||
qCDebug(scriptengine) << "entityScriptContentAvailable -- flagging " << entityScript << " as BAD_SCRIPT_UUID_PLACEHOLDER";
|
qCDebug(scriptengine) << "entityScriptContentAvailable -- flagging as BAD_SCRIPT_UUID_PLACEHOLDER";
|
||||||
#endif
|
#endif
|
||||||
// flag the original entityScript as unusuable
|
// flag the original entityScript as unusuable
|
||||||
_occupiedScriptURLs[entityScript] = BAD_SCRIPT_UUID_PLACEHOLDER;
|
_occupiedScriptURLs[entityScript] = BAD_SCRIPT_UUID_PLACEHOLDER;
|
||||||
|
@ -2352,7 +2349,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
||||||
timeout.setSingleShot(true);
|
timeout.setSingleShot(true);
|
||||||
timeout.start(SANDBOX_TIMEOUT);
|
timeout.start(SANDBOX_TIMEOUT);
|
||||||
connect(&timeout, &QTimer::timeout, [=, &sandbox]{
|
connect(&timeout, &QTimer::timeout, [=, &sandbox]{
|
||||||
qCDebug(scriptengine) << "ScriptEngine::entityScriptContentAvailable timeout(" << scriptOrURL << ")";
|
qCDebug(scriptengine) << "ScriptEngine::entityScriptContentAvailable timeout";
|
||||||
|
|
||||||
// Guard against infinite loops and non-performant code
|
// Guard against infinite loops and non-performant code
|
||||||
sandbox.raiseException(
|
sandbox.raiseException(
|
||||||
|
|
|
@ -112,7 +112,7 @@ QUrl expandScriptUrl(const QUrl& rawScriptURL) {
|
||||||
|
|
||||||
QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation();
|
QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation();
|
||||||
if (!defaultScriptsLoc.isParentOf(url)) {
|
if (!defaultScriptsLoc.isParentOf(url)) {
|
||||||
qCWarning(scriptengine) << "Script.include() ignoring file path" << rawScriptURL
|
qCWarning(scriptengine) << "Script.include() ignoring file path"
|
||||||
<< "-- outside of standard libraries: "
|
<< "-- outside of standard libraries: "
|
||||||
<< url.path()
|
<< url.path()
|
||||||
<< defaultScriptsLoc.path();
|
<< defaultScriptsLoc.path();
|
||||||
|
@ -393,7 +393,6 @@ void ScriptEngines::stopAllScripts(bool restart) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop all scripts
|
// stop all scripts
|
||||||
qCDebug(scriptengine) << "stopping script..." << it.key();
|
|
||||||
scriptEngine->stop();
|
scriptEngine->stop();
|
||||||
removeScriptEngine(scriptEngine);
|
removeScriptEngine(scriptEngine);
|
||||||
}
|
}
|
||||||
|
@ -403,11 +402,8 @@ void ScriptEngines::stopAllScripts(bool restart) {
|
||||||
for(const auto &scriptName : toReload) {
|
for(const auto &scriptName : toReload) {
|
||||||
auto scriptEngine = getScriptEngine(scriptName);
|
auto scriptEngine = getScriptEngine(scriptName);
|
||||||
if (scriptEngine && !scriptEngine->isFinished()) {
|
if (scriptEngine && !scriptEngine->isFinished()) {
|
||||||
qCDebug(scriptengine) << "waiting on script:" << scriptName;
|
|
||||||
scriptEngine->waitTillDoneRunning();
|
scriptEngine->waitTillDoneRunning();
|
||||||
qCDebug(scriptengine) << "done waiting on script:" << scriptName;
|
|
||||||
}
|
}
|
||||||
qCDebug(scriptengine) << "reloading script..." << scriptName;
|
|
||||||
reloadScript(scriptName);
|
reloadScript(scriptName);
|
||||||
}
|
}
|
||||||
if (restart) {
|
if (restart) {
|
||||||
|
@ -445,7 +441,6 @@ bool ScriptEngines::stopScript(const QString& rawScriptURL, bool restart) {
|
||||||
scriptEngine->stop();
|
scriptEngine->stop();
|
||||||
removeScriptEngine(scriptEngine);
|
removeScriptEngine(scriptEngine);
|
||||||
stoppedScript = true;
|
stoppedScript = true;
|
||||||
qCDebug(scriptengine) << "stopping script..." << scriptURL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stoppedScript;
|
return stoppedScript;
|
||||||
|
|
Loading…
Reference in a new issue