Merge pull request #4086 from huffman/std-to-qstring

Std to qstring
This commit is contained in:
Clément Brisset 2015-01-12 16:19:28 -08:00
commit 206e1e48f6
4 changed files with 49 additions and 49 deletions

View file

@ -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();

View file

@ -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<QHash<int, int> > blendshapeIndexMaps;
QVector<QPair<int, int> > partMaterialTextures;
QHash<QString, int> texcoordSetMap;
std::map<std::string, int> texcoordSetMap2;
std::map<QString, int> texcoordSetMap2;
};
class AttributeData {
public:
QVector<glm::vec2> texCoords;
QVector<int> 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<QString, int>::iterator it = data.extracted.texcoordSetMap.find(QString(attrib.name.c_str()));
QHash<QString, int>::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<QString, Material>& materials,
return false;
}
int matchTextureUVSetToAttributeChannel(const std::string& texUVSetName, const QHash<QString, int>& texcoordChannels) {
if (texUVSetName.empty()) {
int matchTextureUVSetToAttributeChannel(const QString& texUVSetName, const QHash<QString, int>& texcoordChannels) {
if (texUVSetName.isEmpty()) {
return 0;
} else {
QHash<QString, int>::const_iterator tcUnit = texcoordChannels.find(QString(texUVSetName.c_str()));
QHash<QString, int>::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<double>();
}
@ -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<QString, QString> yComponents;
QHash<QString, QString> zComponents;
std::map<std::string, FBXLight> lights;
std::map<QString, FBXLight> 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<uint8_t>(tex.currentTextureBlendMode, property.properties.at(index).value<int>());
} 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<std::string> properties;
std::vector<QString> 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;
}
}

View file

@ -110,7 +110,7 @@ public:
Transform transform;
int texcoordSet;
std::string texcoordSetName;
QString texcoordSetName;
};
/// A single part of a mesh (with the same material).

View file

@ -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");