From aeeff73a713397b2b483d54b0cabc0de327a8aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 27 Nov 2021 14:42:49 +0100 Subject: [PATCH] Trade: use ` LayerName` instead of `$LayerName` in MaterialData. Reason is that Assimp custom material attribute names are also prefixed with $ and other weird characters, which could lead to them appearing before $LayerName, causing a layer to falsely appear unnamed. A space, instead, is before all printable characters so it's guaranteed to be always first. Some things you just don't realize at first. Fortunately the binary layout isn't pinned yet for the serialization format so this change is mostly fine. --- src/Magnum/MeshTools/sceneconverter.cpp | 2 +- .../materialAttributeProperties.hpp | 2 +- src/Magnum/Trade/MaterialData.cpp | 8 +- src/Magnum/Trade/MaterialData.h | 17 ++-- src/Magnum/Trade/Test/MaterialDataTest.cpp | 90 +++++++++---------- 5 files changed, 60 insertions(+), 59 deletions(-) diff --git a/src/Magnum/MeshTools/sceneconverter.cpp b/src/Magnum/MeshTools/sceneconverter.cpp index 559b57273a..7f7d01db8f 100644 --- a/src/Magnum/MeshTools/sceneconverter.cpp +++ b/src/Magnum/MeshTools/sceneconverter.cpp @@ -694,7 +694,7 @@ used.)") /* Ignore layer name (which is always first) unless it's in the base material, in which case we print it as it wouldn't otherwise be shown anywhere */ - if(i && !j && info.data.attributeName(i, j) == "$LayerName") + if(i && !j && info.data.attributeName(i, j) == " LayerName") continue; d << Debug::newline << indent diff --git a/src/Magnum/Trade/Implementation/materialAttributeProperties.hpp b/src/Magnum/Trade/Implementation/materialAttributeProperties.hpp index 2f103d0260..1462570ab4 100644 --- a/src/Magnum/Trade/Implementation/materialAttributeProperties.hpp +++ b/src/Magnum/Trade/Implementation/materialAttributeProperties.hpp @@ -25,7 +25,7 @@ /* See Magnum/Trade/MaterialData.cpp and Magnum/Trade/Test/MaterialDataTest.cpp */ #ifdef _c -_cnt(LayerName,"$LayerName",String,Containers::StringView) +_cnt(LayerName," LayerName",String,Containers::StringView) _c(AlphaMask,Float) _ct(AlphaBlend,Bool,bool) _ct(DoubleSided,Bool,bool) diff --git a/src/Magnum/Trade/MaterialData.cpp b/src/Magnum/Trade/MaterialData.cpp index 77e8135f46..bcff89b2bd 100644 --- a/src/Magnum/Trade/MaterialData.cpp +++ b/src/Magnum/Trade/MaterialData.cpp @@ -314,7 +314,7 @@ Containers::StringView MaterialData::attributeString(const MaterialAttribute nam UnsignedInt MaterialData::layerFor(const Containers::StringView layer) const { for(std::size_t i = 1; i < _layerOffsets.size(); ++i) { if(_layerOffsets[i] > _layerOffsets[i - 1] && - _data[_layerOffsets[i - 1]].name() == "$LayerName"_s && + _data[_layerOffsets[i - 1]].name() == " LayerName"_s && _data[_layerOffsets[i - 1]].value() == layer) return i; } @@ -348,7 +348,7 @@ Containers::StringView MaterialData::layerName(const UnsignedInt layer) const { CORRADE_ASSERT(layer < layerCount(), "Trade::MaterialData::layerName(): index" << layer << "out of range for" << layerCount() << "layers", {}); /* Deliberately ignore this attribute in the base material */ - if(layer && _layerOffsets[layer] > _layerOffsets[layer - 1] && _data[_layerOffsets[layer - 1]].name() == "$LayerName") + if(layer && _layerOffsets[layer] > _layerOffsets[layer - 1] && _data[_layerOffsets[layer - 1]].name() == " LayerName") return _data[_layerOffsets[layer - 1]].value(); return {}; } @@ -953,9 +953,9 @@ Debug& operator<<(Debug& debug, const MaterialAttribute value) { if(UnsignedInt(value) - 1 >= Containers::arraySize(AttributeMap)) return debug << "(" << Debug::nospace << reinterpret_cast(UnsignedInt(value)) << Debug::nospace << ")"; - /* LayerName is prefixed with $, drop that */ + /* LayerName is prefixed with a single space, drop that */ Containers::StringView string = AttributeMap[UnsignedInt(value) - 1].name; - if(string[0] == '$') string = string.suffix(1); + if(string[0] == ' ') string = string.suffix(1); return debug << "::" << Debug::nospace << string; } diff --git a/src/Magnum/Trade/MaterialData.h b/src/Magnum/Trade/MaterialData.h index 558d3fcf99..3debd0bec8 100644 --- a/src/Magnum/Trade/MaterialData.h +++ b/src/Magnum/Trade/MaterialData.h @@ -93,7 +93,7 @@ MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, MaterialLayer value); Convenience aliases to actual attribute name strings. In most cases the alias is in the same form and capitalization --- so for example @ref MaterialAttribute::DoubleSided is an alias for @cpp "DoubleSided" @ce, the -only exception is @ref MaterialAttribute::LayerName which is @cpp "$LayerName" @ce. +only exception is @ref MaterialAttribute::LayerName which is @cpp " LayerName" @ce (with a space at the front). When this enum si used in @ref MaterialAttributeData constructors, the data are additionally checked for @@ -108,9 +108,9 @@ enum class MaterialAttribute: UnsignedInt { * Layer name, @ref MaterialAttributeType::String. * * Unlike other attributes where string name matches the enum name, in this - * case the corresponding string is @cpp "$LayerName" @ce, done in order to - * have the layer name attribute appear first in each layer and thus - * simplify layer implementation. + * case the corresponding string is @cpp " LayerName" @ce (with a space at + * the front), done in order to have the layer name attribute appear first + * in each layer and thus simplify layer implementation. * @see @ref MaterialData::layerName() */ LayerName = 1, @@ -1591,10 +1591,11 @@ already sorted by name. @subsection Trade-MaterialData-populating-custom Custom material attributes -While attribute names beginning with uppercase letters are reserved for builtin -Magnum attributes, anything beginning with a lowercase letter or a non-letter -can be a custom attribute. For greater flexibility, custom attributes can be -also strings or pointers, allowing you to store arbitrary properties or direct +While attribute names beginning with uppercase letters and whitespace are +reserved for builtin Magnum attributes, anything beginning with a lowercase +letter or a printable non-letter character can be a custom attribute. For +greater flexibility, custom attributes can be also strings or pointers, +allowing you to store arbitrary properties such as image filenames or direct texture pointers instead of IDs: @snippet MagnumTrade.cpp MaterialData-populating-custom diff --git a/src/Magnum/Trade/Test/MaterialDataTest.cpp b/src/Magnum/Trade/Test/MaterialDataTest.cpp index 905dafed80..54aa9369c3 100644 --- a/src/Magnum/Trade/Test/MaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/MaterialDataTest.cpp @@ -603,7 +603,7 @@ void MaterialDataTest::constructAttributeNameStringValue() { byte isn't read by accident*/ MaterialAttributeData attribute{MaterialAttribute::LayerName, "a value\0that's long but still fits!!"_s.except(1)}; - CORRADE_COMPARE(attribute.name(), "$LayerName"); + CORRADE_COMPARE(attribute.name(), " LayerName"); CORRADE_COMPARE(attribute.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(attribute.name()[attribute.name().size()], '\0'); CORRADE_COMPARE(attribute.type(), MaterialAttributeType::String); @@ -616,7 +616,7 @@ void MaterialDataTest::constructAttributeNameStringValue() { /* Type-erased variant */ const Containers::StringView value = "a value\0that's long but still fits!!"_s.except(1); MaterialAttributeData typeErased{MaterialAttribute::LayerName, MaterialAttributeType::String, &value}; - CORRADE_COMPARE(typeErased.name(), "$LayerName"); + CORRADE_COMPARE(typeErased.name(), " LayerName"); CORRADE_COMPARE(typeErased.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(typeErased.name()[typeErased.name().size()], '\0'); CORRADE_COMPARE(typeErased.type(), MaterialAttributeType::String); @@ -648,7 +648,7 @@ void MaterialDataTest::constructAttributeTextureSwizzle() { void MaterialDataTest::constructAttributeLayer() { MaterialAttributeData attribute{MaterialLayer::ClearCoat}; - CORRADE_COMPARE(attribute.name(), "$LayerName"); + CORRADE_COMPARE(attribute.name(), " LayerName"); CORRADE_COMPARE(attribute.type(), MaterialAttributeType::String); CORRADE_COMPARE(attribute.value(), "ClearCoat"); } @@ -755,7 +755,7 @@ void MaterialDataTest::constructAttributeTooLargeNameString() { Error redirectError{&out}; MaterialAttributeData{MaterialAttribute::LayerName, "This is a problem, got a huge, yuuge value to store"}; CORRADE_COMPARE(out.str(), - "Trade::MaterialAttributeData: name $LayerName and value This is a problem, got a huge, yuuge value to store too long, expected at most 60 bytes in total but got 61\n"); + "Trade::MaterialAttributeData: name LayerName and value This is a problem, got a huge, yuuge value to store too long, expected at most 60 bytes in total but got 61\n"); } void MaterialDataTest::constructAttributeWrongAccessType() { @@ -1026,7 +1026,7 @@ void MaterialDataTest::constructLayers() { CORRADE_COMPARE(data.attributeName(0, 0), "DiffuseTextureCoordinates"); CORRADE_COMPARE(data.attributeName(0, 1), "DoubleSided"); - CORRADE_COMPARE(data.attributeName(1, 0), "$LayerName"); + CORRADE_COMPARE(data.attributeName(1, 0), " LayerName"); CORRADE_COMPARE(data.attributeName(1, 1), "AlphaBlend"); CORRADE_COMPARE(data.attributeName(1, 2), "highlightColor"); @@ -1093,37 +1093,37 @@ void MaterialDataTest::constructLayers() { CORRADE_VERIFY(data.hasAttribute(0, "DoubleSided")); CORRADE_VERIFY(!data.hasAttribute(0, "highlightColor")); CORRADE_VERIFY(data.hasAttribute(1, "highlightColor")); - CORRADE_VERIFY(data.hasAttribute(1, "$LayerName")); - CORRADE_VERIFY(!data.hasAttribute(2, "$LayerName")); + CORRADE_VERIFY(data.hasAttribute(1, " LayerName")); + CORRADE_VERIFY(!data.hasAttribute(2, " LayerName")); CORRADE_VERIFY(!data.hasAttribute(2, "NormalTexture")); CORRADE_VERIFY(data.hasAttribute(3, "NormalTexture")); CORRADE_COMPARE(data.attributeId(0, "DoubleSided"), 1); CORRADE_COMPARE(data.attributeId(1, "highlightColor"), 2); - CORRADE_COMPARE(data.attributeId(1, "$LayerName"), 0); + CORRADE_COMPARE(data.attributeId(1, " LayerName"), 0); CORRADE_COMPARE(data.attributeId(3, "NormalTexture"), 0); CORRADE_COMPARE(data.attributeType(0, "DoubleSided"), MaterialAttributeType::Bool); CORRADE_COMPARE(data.attributeType(1, "highlightColor"), MaterialAttributeType::Vector4); - CORRADE_COMPARE(data.attributeType(1, "$LayerName"), MaterialAttributeType::String); + CORRADE_COMPARE(data.attributeType(1, " LayerName"), MaterialAttributeType::String); CORRADE_COMPARE(data.attributeType(3, "NormalTexture"), MaterialAttributeType::UnsignedInt); CORRADE_COMPARE(data.attribute(0, "DoubleSided"), true); CORRADE_COMPARE(data.attribute(1, "highlightColor"), 0x335566ff_rgbaf); - CORRADE_COMPARE(data.attribute(1, "$LayerName"), "ClearCoat"); + CORRADE_COMPARE(data.attribute(1, " LayerName"), "ClearCoat"); CORRADE_COMPARE(data.attribute(3, "NormalTexture"), 3); CORRADE_COMPARE(data.mutableAttribute(0, "DoubleSided"), true); CORRADE_COMPARE(data.mutableAttribute(1, "highlightColor"), 0x335566ff_rgbaf); - CORRADE_COMPARE(data.mutableAttribute(1, "$LayerName"), "ClearCoat"_s); + CORRADE_COMPARE(data.mutableAttribute(1, " LayerName"), "ClearCoat"_s); CORRADE_COMPARE(data.mutableAttribute(3, "NormalTexture"), 3); CORRADE_COMPARE(*static_cast(data.attribute(0, "DoubleSided")), true); CORRADE_COMPARE(*static_cast(data.attribute(1, "highlightColor")), 0x335566ff_rgbaf); - CORRADE_COMPARE(static_cast(data.attribute(1, "$LayerName")), "ClearCoat"_s); + CORRADE_COMPARE(static_cast(data.attribute(1, " LayerName")), "ClearCoat"_s); CORRADE_COMPARE(*static_cast(data.attribute(3, "NormalTexture")), 3); CORRADE_COMPARE(*static_cast(data.mutableAttribute(0, "DoubleSided")), true); CORRADE_COMPARE(*static_cast(data.mutableAttribute(1, "highlightColor")), 0x335566ff_rgbaf); - CORRADE_COMPARE(static_cast(data.mutableAttribute(1, "$LayerName")), "ClearCoat"_s); + CORRADE_COMPARE(static_cast(data.mutableAttribute(1, " LayerName")), "ClearCoat"_s); CORRADE_COMPARE(*static_cast(data.mutableAttribute(3, "NormalTexture")), 3); /* Access by layer name and attribute ID */ @@ -1165,23 +1165,23 @@ void MaterialDataTest::constructLayers() { /* Access by layer name and attribute string */ CORRADE_VERIFY(data.hasAttribute(MaterialLayer::ClearCoat, "highlightColor")); - CORRADE_VERIFY(data.hasAttribute(MaterialLayer::ClearCoat, "$LayerName")); + CORRADE_VERIFY(data.hasAttribute(MaterialLayer::ClearCoat, " LayerName")); CORRADE_COMPARE(data.attributeId(MaterialLayer::ClearCoat, "highlightColor"), 2); - CORRADE_COMPARE(data.attributeId(MaterialLayer::ClearCoat, "$LayerName"), 0); + CORRADE_COMPARE(data.attributeId(MaterialLayer::ClearCoat, " LayerName"), 0); CORRADE_COMPARE(data.attributeType(MaterialLayer::ClearCoat, "highlightColor"), MaterialAttributeType::Vector4); - CORRADE_COMPARE(data.attributeType(MaterialLayer::ClearCoat, "$LayerName"), MaterialAttributeType::String); + CORRADE_COMPARE(data.attributeType(MaterialLayer::ClearCoat, " LayerName"), MaterialAttributeType::String); CORRADE_COMPARE(data.attribute(MaterialLayer::ClearCoat, "highlightColor"), 0x335566ff_rgbaf); - CORRADE_COMPARE(data.attribute(MaterialLayer::ClearCoat, "$LayerName"), "ClearCoat"); + CORRADE_COMPARE(data.attribute(MaterialLayer::ClearCoat, " LayerName"), "ClearCoat"); CORRADE_COMPARE(data.mutableAttribute(MaterialLayer::ClearCoat, "highlightColor"), 0x335566ff_rgbaf); - CORRADE_COMPARE(data.mutableAttribute(MaterialLayer::ClearCoat, "$LayerName"), "ClearCoat"_s); + CORRADE_COMPARE(data.mutableAttribute(MaterialLayer::ClearCoat, " LayerName"), "ClearCoat"_s); CORRADE_COMPARE(*static_cast(data.attribute(MaterialLayer::ClearCoat, "highlightColor")), 0x335566ff_rgbaf); - CORRADE_COMPARE(static_cast(data.attribute(MaterialLayer::ClearCoat, "$LayerName")), "ClearCoat"_s); + CORRADE_COMPARE(static_cast(data.attribute(MaterialLayer::ClearCoat, " LayerName")), "ClearCoat"_s); CORRADE_COMPARE(*static_cast(data.mutableAttribute(MaterialLayer::ClearCoat, "highlightColor")), 0x335566ff_rgbaf); - CORRADE_COMPARE(static_cast(data.mutableAttribute(MaterialLayer::ClearCoat, "$LayerName")), "ClearCoat"_s); + CORRADE_COMPARE(static_cast(data.mutableAttribute(MaterialLayer::ClearCoat, " LayerName")), "ClearCoat"_s); /* Access by layer string and attribute ID */ CORRADE_COMPARE(data.attributeName("ClearCoat", 1), "AlphaBlend"); @@ -1222,23 +1222,23 @@ void MaterialDataTest::constructLayers() { /* Access by layer string and attribute string */ CORRADE_VERIFY(data.hasAttribute("ClearCoat", "highlightColor")); - CORRADE_VERIFY(data.hasAttribute("ClearCoat", "$LayerName")); + CORRADE_VERIFY(data.hasAttribute("ClearCoat", " LayerName")); CORRADE_COMPARE(data.attributeId("ClearCoat", "highlightColor"), 2); - CORRADE_COMPARE(data.attributeId("ClearCoat", "$LayerName"), 0); + CORRADE_COMPARE(data.attributeId("ClearCoat", " LayerName"), 0); CORRADE_COMPARE(data.attributeType("ClearCoat", "highlightColor"), MaterialAttributeType::Vector4); - CORRADE_COMPARE(data.attributeType("ClearCoat", "$LayerName"), MaterialAttributeType::String); + CORRADE_COMPARE(data.attributeType("ClearCoat", " LayerName"), MaterialAttributeType::String); CORRADE_COMPARE(data.attribute("ClearCoat", "highlightColor"), 0x335566ff_rgbaf); - CORRADE_COMPARE(data.attribute("ClearCoat", "$LayerName"), "ClearCoat"); + CORRADE_COMPARE(data.attribute("ClearCoat", " LayerName"), "ClearCoat"); CORRADE_COMPARE(data.mutableAttribute("ClearCoat", "highlightColor"), 0x335566ff_rgbaf); - CORRADE_COMPARE(data.mutableAttribute("ClearCoat", "$LayerName"), "ClearCoat"_s); + CORRADE_COMPARE(data.mutableAttribute("ClearCoat", " LayerName"), "ClearCoat"_s); CORRADE_COMPARE(*static_cast(data.attribute("ClearCoat", "highlightColor")), 0x335566ff_rgbaf); - CORRADE_COMPARE(static_cast(data.attribute("ClearCoat", "$LayerName")), "ClearCoat"_s); + CORRADE_COMPARE(static_cast(data.attribute("ClearCoat", " LayerName")), "ClearCoat"_s); CORRADE_COMPARE(*static_cast(data.mutableAttribute("ClearCoat", "highlightColor")), 0x335566ff_rgbaf); - CORRADE_COMPARE(static_cast(data.mutableAttribute("ClearCoat", "$LayerName")), "ClearCoat"_s); + CORRADE_COMPARE(static_cast(data.mutableAttribute("ClearCoat", " LayerName")), "ClearCoat"_s); } void MaterialDataTest::constructLayersNotMonotonic() { @@ -1314,7 +1314,7 @@ void MaterialDataTest::constructNonOwnedLayers() { {"DiffuseCoordinateSet"_s, 5u}, {"DoubleSided"_s, true}, - {"$LayerName"_s, "ClearCoat"_s}, + {" LayerName"_s, "ClearCoat"_s}, {"AlphaBlend"_s, true}, {"highlightColor"_s, Vector4{0.2f, 0.6f, 0.4f, 1.0f}}, @@ -1361,7 +1361,7 @@ void MaterialDataTest::constructNonOwnedLayers() { CORRADE_COMPARE(data.attributeName(0, 0), "DiffuseCoordinateSet"); CORRADE_COMPARE(data.attributeName(0, 1), "DoubleSided"); - CORRADE_COMPARE(data.attributeName(1, 0), "$LayerName"); + CORRADE_COMPARE(data.attributeName(1, 0), " LayerName"); CORRADE_COMPARE(data.attributeName(1, 1), "AlphaBlend"); CORRADE_COMPARE(data.attributeName(1, 2), "highlightColor"); @@ -1687,10 +1687,10 @@ void MaterialDataTest::accessMutable() { ++*static_cast(data.mutableAttribute(0)); ++*static_cast(data.mutableAttribute(MaterialAttribute::LayerName)); - ++*static_cast(data.mutableAttribute("$LayerName")); + ++*static_cast(data.mutableAttribute(" LayerName")); ++data.mutableAttribute(0)[0]; ++data.mutableAttribute(MaterialAttribute::LayerName)[0]; - ++data.mutableAttribute("$LayerName")[0]; + ++data.mutableAttribute(" LayerName")[0]; CORRADE_COMPARE(data.attribute(MaterialAttribute::LayerName), "gye"_s); } @@ -2108,10 +2108,10 @@ void MaterialDataTest::accessLayerIndexMutable() { CORRADE_COMPARE(data.attribute(1, MaterialAttribute::Roughness), 64.0f); ++*static_cast(data.mutableAttribute(1, 0)); - ++*static_cast(data.mutableAttribute(1, "$LayerName")); + ++*static_cast(data.mutableAttribute(1, " LayerName")); ++*static_cast(data.mutableAttribute(1, MaterialAttribute::LayerName)); ++data.mutableAttribute(1, 0)[0]; - ++data.mutableAttribute(1, "$LayerName")[0]; + ++data.mutableAttribute(1, " LayerName")[0]; ++data.mutableAttribute(1, MaterialAttribute::LayerName)[0]; CORRADE_COMPARE(data.attribute(1, MaterialAttribute::LayerName), "IlearCoat"_s); } @@ -2138,7 +2138,7 @@ void MaterialDataTest::accessLayerNameMutable() { CORRADE_COMPARE(data.attribute(1, 0), "DlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - *static_cast(data.mutableAttribute(MaterialLayer::ClearCoat, "$LayerName")) = 'E'; + *static_cast(data.mutableAttribute(MaterialLayer::ClearCoat, " LayerName")) = 'E'; CORRADE_COMPARE(data.attribute(1, 0), "ElearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { @@ -2150,11 +2150,11 @@ void MaterialDataTest::accessLayerNameMutable() { CORRADE_COMPARE(data.attribute(1, 0), "GlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - data.mutableAttribute(MaterialLayer::ClearCoat, "$LayerName")[0] = 'H'; + data.mutableAttribute(MaterialLayer::ClearCoat, " LayerName")[0] = 'H'; CORRADE_COMPARE(data.attribute(1, 0), "HlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - data.mutableAttribute(MaterialLayer::ClearCoat, "$LayerName")[0] = 'I'; + data.mutableAttribute(MaterialLayer::ClearCoat, " LayerName")[0] = 'I'; CORRADE_COMPARE(data.attribute(1, 0), "IlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } @@ -2182,7 +2182,7 @@ void MaterialDataTest::accessLayerStringMutable() { CORRADE_COMPARE(data.attribute(1, 0), "DlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - *static_cast(data.mutableAttribute("ClearCoat", "$LayerName")) = 'E'; + *static_cast(data.mutableAttribute("ClearCoat", " LayerName")) = 'E'; CORRADE_COMPARE(data.attribute(1, 0), "ElearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { @@ -2194,11 +2194,11 @@ void MaterialDataTest::accessLayerStringMutable() { CORRADE_COMPARE(data.attribute(1, 0), "GlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - data.mutableAttribute("ClearCoat", "$LayerName")[0] = 'H'; + data.mutableAttribute("ClearCoat", " LayerName")[0] = 'H'; CORRADE_COMPARE(data.attribute(1, 0), "HlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - data.mutableAttribute("ClearCoat", "$LayerName")[0] = 'I'; + data.mutableAttribute("ClearCoat", " LayerName")[0] = 'I'; CORRADE_COMPARE(data.attribute(1, 0), "IlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } @@ -2745,7 +2745,7 @@ void MaterialDataTest::accessMutableNotAllowed() { data.mutableAttribute(1, "Roughness"); data.mutableAttribute(1, MaterialAttribute::Roughness); data.mutableAttribute(1, 0); - data.mutableAttribute(1, "$LayerName"); + data.mutableAttribute(1, " LayerName"); data.mutableAttribute(1, MaterialAttribute::LayerName); data.mutableAttribute("ClearCoat", 1); @@ -2755,7 +2755,7 @@ void MaterialDataTest::accessMutableNotAllowed() { data.mutableAttribute("ClearCoat", "Roughness"); data.mutableAttribute("ClearCoat", MaterialAttribute::Roughness); data.mutableAttribute("ClearCoat", 0); - data.mutableAttribute("ClearCoat", "$LayerName"); + data.mutableAttribute("ClearCoat", " LayerName"); data.mutableAttribute("ClearCoat", MaterialAttribute::LayerName); data.mutableAttribute(MaterialLayer::ClearCoat, 1); @@ -2765,7 +2765,7 @@ void MaterialDataTest::accessMutableNotAllowed() { data.mutableAttribute(MaterialLayer::ClearCoat, "Roughness"); data.mutableAttribute(MaterialLayer::ClearCoat, MaterialAttribute::Roughness); data.mutableAttribute(MaterialLayer::ClearCoat, 0); - data.mutableAttribute(MaterialLayer::ClearCoat, "$LayerName"); + data.mutableAttribute(MaterialLayer::ClearCoat, " LayerName"); data.mutableAttribute(MaterialLayer::ClearCoat, MaterialAttribute::LayerName); CORRADE_COMPARE(out.str(), "Trade::MaterialData::mutableAttribute(): attribute data not mutable\n" @@ -2925,7 +2925,7 @@ void MaterialDataTest::templateLayerAccessMutable() { CORRADE_COMPARE(data.attribute(1, 0), "DlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - *static_cast(data.mutableAttribute("ClearCoat", "$LayerName")) = 'E'; + *static_cast(data.mutableAttribute("ClearCoat", " LayerName")) = 'E'; CORRADE_COMPARE(data.attribute(1, 0), "ElearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { @@ -2937,11 +2937,11 @@ void MaterialDataTest::templateLayerAccessMutable() { CORRADE_COMPARE(data.attribute(1, 0), "GlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - data.mutableAttribute("ClearCoat", "$LayerName")[0] = 'H'; + data.mutableAttribute("ClearCoat", " LayerName")[0] = 'H'; CORRADE_COMPARE(data.attribute(1, 0), "HlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; } { - data.mutableAttribute("ClearCoat", "$LayerName")[0] = 'I'; + data.mutableAttribute("ClearCoat", " LayerName")[0] = 'I'; CORRADE_COMPARE(data.attribute(1, 0), "IlearCoat"); *static_cast(data.mutableAttribute(1, 0)) = 'C'; }