use # instead of ? for material URL name selection

This commit is contained in:
SamGondelman 2019-04-08 23:45:47 -07:00
parent 78256fb5bb
commit a50cca006e
4 changed files with 9 additions and 5 deletions

View file

@ -285,7 +285,7 @@ void ModelBaker::handleFinishedMaterialBaker() {
QJsonArray materialMapping;
for (auto material : _hfmModel->materials) {
QJsonObject json;
json["mat::" + material.name] = relativeBakedMaterialURL + "?" + material.name;
json["mat::" + material.name] = relativeBakedMaterialURL + "#" + material.name;
materialMapping.push_back(json);
}

View file

@ -121,7 +121,11 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
QString materialURL = entity->getMaterialURL();
if (materialURL != _materialURL) {
_materialURL = materialURL;
if (_materialURL.contains("?")) {
if (_materialURL.contains("#")) {
auto split = _materialURL.split("#");
newCurrentMaterialName = split.last().toStdString();
} else if (_materialURL.contains("?")) {
qDebug() << "DEPRECATED: Use # instead of ? for material URLS:" << _materialURL;
auto split = _materialURL.split("?");
newCurrentMaterialName = split.last().toStdString();
}

View file

@ -976,7 +976,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* by setting the <code>entityHostType</code> parameter in {@link Entities.addEntity} to <code>"avatar"</code>.
* Material entities render as non-scalable spheres if they don't have their parent set.
* @typedef {object} Entities.EntityProperties-Material
* @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append <code>?name</code> to the URL, the
* @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append <code>#name</code> to the URL, the
* material with that name in the {@link MaterialResource} will be applied to the entity. <br />
* Alternatively, set the property value to <code>"materialData"</code> to use the <code>materialData</code> property
* for the {@link MaterialResource} values.

View file

@ -1561,8 +1561,8 @@ void Model::applyMaterialMapping() {
{
QString url = networkMaterialResource->getURL().toString();
bool foundMaterialName = false;
if (url.contains("?")) {
auto split = url.split("?");
if (url.contains("#")) {
auto split = url.split("#");
std::string materialName = split.last().toStdString();
auto networkMaterialIter = networkMaterialResource->parsedMaterials.networkMaterials.find(materialName);
if (networkMaterialIter != networkMaterialResource->parsedMaterials.networkMaterials.end()) {