mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 12:12:32 +02:00
Merge pull request #11951 from dback2/polymaterialurl
Allow space characters in material library name
This commit is contained in:
commit
637e24504c
2 changed files with 4 additions and 4 deletions
|
@ -56,7 +56,7 @@ float OBJTokenizer::getFloat() {
|
||||||
return std::stof((nextToken() != OBJTokenizer::DATUM_TOKEN) ? nullptr : getDatum().data());
|
return std::stof((nextToken() != OBJTokenizer::DATUM_TOKEN) ? nullptr : getDatum().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
int OBJTokenizer::nextToken() {
|
int OBJTokenizer::nextToken(bool allowSpaceChar /*= false*/) {
|
||||||
if (_pushedBackToken != NO_PUSHBACKED_TOKEN) {
|
if (_pushedBackToken != NO_PUSHBACKED_TOKEN) {
|
||||||
int token = _pushedBackToken;
|
int token = _pushedBackToken;
|
||||||
_pushedBackToken = NO_PUSHBACKED_TOKEN;
|
_pushedBackToken = NO_PUSHBACKED_TOKEN;
|
||||||
|
@ -93,7 +93,7 @@ int OBJTokenizer::nextToken() {
|
||||||
_datum = "";
|
_datum = "";
|
||||||
_datum.append(ch);
|
_datum.append(ch);
|
||||||
while (_device->getChar(&ch)) {
|
while (_device->getChar(&ch)) {
|
||||||
if (QChar(ch).isSpace() || ch == '\"') {
|
if ((QChar(ch).isSpace() || ch == '\"') && (!allowSpaceChar || ch != ' ')) {
|
||||||
ungetChar(ch); // read until we encounter a special character, then replace it
|
ungetChar(ch); // read until we encounter a special character, then replace it
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
|
||||||
currentMaterialName = QString("part-") + QString::number(_partCounter++);
|
currentMaterialName = QString("part-") + QString::number(_partCounter++);
|
||||||
}
|
}
|
||||||
} else if (token == "mtllib" && !_url.isEmpty()) {
|
} else if (token == "mtllib" && !_url.isEmpty()) {
|
||||||
if (tokenizer.nextToken() != OBJTokenizer::DATUM_TOKEN) {
|
if (tokenizer.nextToken(true) != OBJTokenizer::DATUM_TOKEN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QByteArray libraryName = tokenizer.getDatum();
|
QByteArray libraryName = tokenizer.getDatum();
|
||||||
|
|
|
@ -11,7 +11,7 @@ public:
|
||||||
DATUM_TOKEN = 0x100,
|
DATUM_TOKEN = 0x100,
|
||||||
COMMENT_TOKEN = 0x101
|
COMMENT_TOKEN = 0x101
|
||||||
};
|
};
|
||||||
int nextToken();
|
int nextToken(bool allowSpaceChar = false);
|
||||||
const QByteArray& getDatum() const { return _datum; }
|
const QByteArray& getDatum() const { return _datum; }
|
||||||
bool isNextTokenFloat();
|
bool isNextTokenFloat();
|
||||||
const QByteArray getLineAsDatum(); // some "filenames" have spaces in them
|
const QByteArray getLineAsDatum(); // some "filenames" have spaces in them
|
||||||
|
|
Loading…
Reference in a new issue