From 8bb69d0a9085256a82665ce09ab66c5bff992860 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 9 Jan 2015 16:22:52 -0800 Subject: [PATCH 1/2] Update std::string instances to QString --- interface/CMakeLists.txt | 2 +- libraries/entities/src/EntityTreeElement.cpp | 2 +- libraries/fbx/src/FBXReader.cpp | 90 ++++++++++---------- libraries/fbx/src/FBXReader.h | 2 +- libraries/render-utils/src/GeometryCache.cpp | 4 +- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 8ddd1153ef..77a20201cb 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME interface) project(${TARGET_NAME}) # set a default root dir for each of our optional externals if it was not passed -set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb") +set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb" "Visage") foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR) diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 5f072164a0..a7e7b6fdb3 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -665,7 +665,7 @@ const EntityItem* EntityTreeElement::getEntityWithEntityItemID(const EntityItemI } return foundEntity; } - + EntityItem* EntityTreeElement::getEntityWithEntityItemID(const EntityItemID& id) { EntityItem* foundEntity = NULL; uint16_t numberOfEntities = _entityItems->size(); diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 9532f44acf..8363084d37 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -38,7 +38,7 @@ struct TextureParam { glm::vec2 UVTranslation; glm::vec2 UVScaling; glm::vec4 cropping; - std::string UVSet; + QString UVSet; glm::vec3 translation; glm::vec3 rotation; @@ -802,14 +802,14 @@ public: QVector > blendshapeIndexMaps; QVector > partMaterialTextures; QHash texcoordSetMap; - std::map texcoordSetMap2; + std::map texcoordSetMap2; }; class AttributeData { public: QVector texCoords; QVector texCoordIndices; - std::string name; + QString name; int index; }; @@ -945,12 +945,12 @@ ExtractedMesh extractMesh(const FBXNode& object) { data.texCoordIndices = getIntVector(subdata); attrib.texCoordIndices = getIntVector(subdata); } else if (subdata.name == "Name") { - attrib.name = subdata.properties.at(0).toString().toStdString(); + attrib.name = subdata.properties.at(0).toString(); } #if defined(DEBUG_FBXREADER) else { int unknown = 0; - std::string subname = subdata.name.data(); + QString subname = subdata.name.data(); if ( (subdata.name == "Version") || (subdata.name == "MappingInformationType") || (subdata.name == "ReferenceInformationType") ) { @@ -960,7 +960,7 @@ ExtractedMesh extractMesh(const FBXNode& object) { } #endif } - data.extracted.texcoordSetMap.insert(QString(attrib.name.c_str()), data.attributes.size()); + data.extracted.texcoordSetMap.insert(attrib.name, data.attributes.size()); data.attributes.push_back(attrib); } else { AttributeData attrib; @@ -971,12 +971,12 @@ ExtractedMesh extractMesh(const FBXNode& object) { } else if (subdata.name == "UVIndex") { attrib.texCoordIndices = getIntVector(subdata); } else if (subdata.name == "Name") { - attrib.name = subdata.properties.at(0).toString().toStdString(); + attrib.name = subdata.properties.at(0).toString(); } #if defined(DEBUG_FBXREADER) else { int unknown = 0; - std::string subname = subdata.name.data(); + QString subname = subdata.name.data(); if ( (subdata.name == "Version") || (subdata.name == "MappingInformationType") || (subdata.name == "ReferenceInformationType") ) { @@ -987,9 +987,9 @@ ExtractedMesh extractMesh(const FBXNode& object) { #endif } - QHash::iterator it = data.extracted.texcoordSetMap.find(QString(attrib.name.c_str())); + QHash::iterator it = data.extracted.texcoordSetMap.find(attrib.name); if (it == data.extracted.texcoordSetMap.end()) { - data.extracted.texcoordSetMap.insert(QString(attrib.name.c_str()), data.attributes.size()); + data.extracted.texcoordSetMap.insert(attrib.name, data.attributes.size()); data.attributes.push_back(attrib); } else { // WTF same names for different UVs? @@ -1198,11 +1198,11 @@ bool checkMaterialsHaveTextures(const QHash& materials, return false; } -int matchTextureUVSetToAttributeChannel(const std::string& texUVSetName, const QHash& texcoordChannels) { - if (texUVSetName.empty()) { +int matchTextureUVSetToAttributeChannel(const QString& texUVSetName, const QHash& texcoordChannels) { + if (texUVSetName.isEmpty()) { return 0; } else { - QHash::const_iterator tcUnit = texcoordChannels.find(QString(texUVSetName.c_str())); + QHash::const_iterator tcUnit = texcoordChannels.find(texUVSetName); if (tcUnit != texcoordChannels.end()) { int channel = (*tcUnit); if (channel >= 2) { @@ -1220,13 +1220,13 @@ FBXLight extractLight(const FBXNode& object) { FBXLight light; foreach (const FBXNode& subobject, object.children) { - std::string childname = QString(subobject.name).toStdString(); + QString childname = QString(subobject.name); if (subobject.name == "Properties70") { foreach (const FBXNode& property, subobject.children) { int valIndex = 4; - std::string propName = QString(property.name).toStdString(); + QString propName = QString(property.name); if (property.name == "P") { - std::string propname = property.properties.at(0).toString().toStdString(); + QString propname = property.properties.at(0).toString(); if (propname == "Intensity") { light.intensity = 0.01f * property.properties.at(valIndex).value(); } @@ -1238,13 +1238,13 @@ FBXLight extractLight(const FBXNode& object) { } #if defined(DEBUG_FBXREADER) - std::string type = object.properties.at(0).toString().toStdString(); - type = object.properties.at(1).toString().toStdString(); - type = object.properties.at(2).toString().toStdString(); + QString type = object.properties.at(0).toString(); + type = object.properties.at(1).toString(); + type = object.properties.at(2).toString(); foreach (const QVariant& prop, object.properties) { - std::string proptype = prop.typeName(); - std::string propval = prop.toString().toStdString(); + QString proptype = prop.typeName(); + QString propval = prop.toString(); if (proptype == "Properties70") { } } @@ -1281,7 +1281,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, QHash yComponents; QHash zComponents; - std::map lights; + std::map lights; QVariantHash joints = mapping.value("joint").toHash(); QString jointEyeLeftName = processID(getString(joints.value("jointEyeLeft", "jointEyeLeft"))); @@ -1369,7 +1369,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, int index = 4; foreach (const FBXNode& subobject, object.children) { if (subobject.name == propertyName) { - std::string subpropName = subobject.properties.at(0).toString().toStdString(); + QString subpropName = subobject.properties.at(0).toString(); if (subpropName == "UnitScaleFactor") { unitScaleFactor = subobject.properties.at(index).toFloat(); } else if (subpropName == "AmbientColor") { @@ -1393,8 +1393,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, QString id = getID(object.properties); modelIDsToNames.insert(id, name); - std::string modelname = name.toLower().toStdString(); - if (modelname.find("hifi") == 0) { + QString modelname = name.toLower(); + if (modelname.startsWith("hifi")) { hifiGlobalNodeID = id; } @@ -1527,19 +1527,19 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } #if defined(DEBUG_FBXREADER) else if (subobject.name == "TypeFlags") { - std::string attributetype = subobject.properties.at(0).toString().toStdString(); + QString attributetype = subobject.properties.at(0).toString(); if (!attributetype.empty()) { if (attributetype == "Light") { - std::string lightprop; + QString lightprop; foreach (const QVariant& vprop, subobject.properties) { - lightprop = vprop.toString().toStdString(); + lightprop = vprop.toString(); } FBXLight light = extractLight(object); } } } else { - std::string whatisthat = subobject.name; + QString whatisthat = subobject.name; if (whatisthat == "Shape") { } } @@ -1604,7 +1604,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, if (property.name == propertyName) { QString v = property.properties.at(0).toString(); if (property.properties.at(0) == "UVSet") { - tex.assign(tex.UVSet, property.properties.at(index).toString().toStdString()); + tex.assign(tex.UVSet, property.properties.at(index).toString()); } else if (property.properties.at(0) == "CurrentTextureBlendMode") { tex.assign(tex.currentTextureBlendMode, property.properties.at(index).value()); } else if (property.properties.at(0) == "UseMaterial") { @@ -1618,7 +1618,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } #if defined(DEBUG_FBXREADER) else { - std::string propName = v.toStdString(); + QString propName = v; unknown++; } #endif @@ -1632,7 +1632,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } else if (subobject.name == "FileName") { } else if (subobject.name == "Media") { } else { - std::string subname = subobject.name.data(); + QString subname = subobject.name.data(); unknown++; } } @@ -1693,7 +1693,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } #if defined(DEBUG_FBXREADER) else { - const std::string propname = property.properties.at(0).toString().toStdString(); + const QString propname = property.properties.at(0).toString(); if (propname == "EmissiveFactor") { } } @@ -1703,7 +1703,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } #if defined(DEBUG_FBXREADER) else { - std::string propname = subobject.name.data(); + QString propname = subobject.name.data(); int unknown = 0; if ( (propname == "Version") ||(propname == "ShadingModel") @@ -1719,21 +1719,21 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } else if (object.name == "NodeAttribute") { #if defined(DEBUG_FBXREADER) - std::vector properties; + std::vector properties; foreach(const QVariant& v, object.properties) { - properties.push_back(v.toString().toStdString()); + properties.push_back(v.toString()); } #endif - std::string attribID = getID(object.properties).toStdString(); - std::string attributetype; + QString attribID = getID(object.properties); + QString attributetype; foreach (const FBXNode& subobject, object.children) { if (subobject.name == "TypeFlags") { typeFlags.insert(getID(object.properties), subobject.properties.at(0).toString()); - attributetype = subobject.properties.at(0).toString().toStdString(); + attributetype = subobject.properties.at(0).toString(); } } - if (!attributetype.empty()) { + if (!attributetype.isEmpty()) { if (attributetype == "Light") { FBXLight light = extractLight(object); lights[attribID] = light; @@ -1781,7 +1781,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } #if defined(DEBUG_FBXREADER) else { - std::string objectname = object.name.data(); + QString objectname = object.name.data(); if ( objectname == "Pose" || objectname == "AnimationStack" || objectname == "AnimationLayer" @@ -1800,7 +1800,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, QString parentID = getID(connection.properties, 2); ooChildToParent.insert(childID, parentID); if (!hifiGlobalNodeID.isEmpty() && (parentID == hifiGlobalNodeID)) { - std::map< std::string, FBXLight >::iterator lit = lights.find(childID.toStdString()); + std::map< QString, FBXLight >::iterator lit = lights.find(childID); if (lit != lights.end()) { lightmapLevel = (*lit).second.intensity; if (lightmapLevel <= 0.0f) { @@ -1842,7 +1842,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } else if (loadLightmaps && type.contains("ambient")) { ambientTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1)); } else { - std::string typenam = type.data(); + QString typenam = type.data(); counter++; } } @@ -1853,7 +1853,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, } #if defined(DEBUG_FBXREADER) else { - std::string objectname = child.name.data(); + QString objectname = child.name.data(); if ( objectname == "Pose" || objectname == "CreationTime" || objectname == "FileId" @@ -1875,7 +1875,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, // TODO: check if is code is needed if (!lights.empty()) { if (hifiGlobalNodeID.isEmpty()) { - std::map< std::string, FBXLight >::iterator l = lights.begin(); + std::map< QString, FBXLight >::iterator l = lights.begin(); lightmapLevel = (*l).second.intensity; } } diff --git a/libraries/fbx/src/FBXReader.h b/libraries/fbx/src/FBXReader.h index 44b2bfe4a5..98e4d60826 100644 --- a/libraries/fbx/src/FBXReader.h +++ b/libraries/fbx/src/FBXReader.h @@ -110,7 +110,7 @@ public: Transform transform; int texcoordSet; - std::string texcoordSetName; + QString texcoordSetName; }; /// A single part of a mesh (with the same material). diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 553e460a5c..f7bd56e3ca 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -1871,9 +1871,9 @@ void GeometryReader::run() { if (!_reply) { throw QString("Reply is NULL ?!"); } - std::string urlname = _url.path().toLower().toStdString(); + QString urlname = _url.path().toLower(); bool urlValid = true; - urlValid &= !urlname.empty(); + urlValid &= !urlname.isEmpty(); urlValid &= !_url.path().isEmpty(); urlValid &= _url.path().toLower().endsWith(".fbx") || _url.path().toLower().endsWith(".svo"); From bf71aa6163af4b411d28f0a54991976f4205d025 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 12 Jan 2015 09:15:14 -0800 Subject: [PATCH 2/2] Remove Visage dependency from cmaklists --- interface/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 77a20201cb..8ddd1153ef 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME interface) project(${TARGET_NAME}) # set a default root dir for each of our optional externals if it was not passed -set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb" "Visage") +set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb") foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR)