From 78ed650e76f32839ad91a5d22bf65893efb1fec9 Mon Sep 17 00:00:00 2001 From: danij Date: Fri, 18 Jan 2013 07:35:36 +0000 Subject: [PATCH] Refactor|MaterialManifest: Added MaterialManifest::hasMaterial() MaterialManifest's material() method now returns a reference to the associated material. Use hasMaterial() to determine if a material is presently associated. --- .../include/resource/materialmanifest.h | 18 +++++----- doomsday/engine/src/def_main.cpp | 19 ++++++----- doomsday/engine/src/edit_map.cpp | 4 +-- doomsday/engine/src/map/p_dmu.cpp | 4 +-- doomsday/engine/src/map/p_particle.cpp | 4 ++- doomsday/engine/src/map/r_world.cpp | 2 +- doomsday/engine/src/render/r_draw.cpp | 9 +++-- doomsday/engine/src/render/r_things.cpp | 2 +- doomsday/engine/src/render/rend_console.cpp | 9 ++--- doomsday/engine/src/render/rend_main.cpp | 12 +++---- doomsday/engine/src/render/rend_model.cpp | 6 ++-- doomsday/engine/src/render/sky.cpp | 20 +++++------ doomsday/engine/src/render/sprite.cpp | 4 +-- doomsday/engine/src/resource/api_material.cpp | 2 +- .../engine/src/resource/materialarchive.cpp | 4 +-- .../engine/src/resource/materialmanifest.cpp | 34 +++++++++---------- doomsday/engine/src/resource/materials.cpp | 13 +++---- doomsday/engine/src/ui/finaleinterpreter.cpp | 10 +++--- 18 files changed, 91 insertions(+), 85 deletions(-) diff --git a/doomsday/engine/include/resource/materialmanifest.h b/doomsday/engine/include/resource/materialmanifest.h index c1008fe8eb..b2ef119539 100644 --- a/doomsday/engine/include/resource/materialmanifest.h +++ b/doomsday/engine/include/resource/materialmanifest.h @@ -69,19 +69,21 @@ class MaterialManifest : public PathTree::Node /// @return Unique identifier associated with this. materialid_t id() const; - /// @return @c true if the material manifest is not derived from an original game resource. + /// @return @c true if the manifest is not derived from an original game resource. bool isCustom() const; - /// @return Material associated with the manifest; otherwise @c NULL. - Material *material() const; + /// @return @c true if the manifest has an associated material. + bool hasMaterial() const; /** - * Change the material associated with this manifest. - * - * @post If @a material differs from that currently associated with this, - * any Info presently owned by this will destroyed (its invalid). + * Returns the material associated with the manifest. + */ + Material &material() const; + + /** + * Change the material associated with the manifest. * - * @param material New material to associate with this. + * @param material New material to associate with. */ void setMaterial(Material *material); diff --git a/doomsday/engine/src/def_main.cpp b/doomsday/engine/src/def_main.cpp index 47de59fa82..610f2f53d7 100644 --- a/doomsday/engine/src/def_main.cpp +++ b/doomsday/engine/src/def_main.cpp @@ -1202,13 +1202,12 @@ void Def_Read() try { - MaterialManifest &bind = App_Materials().find(*reinterpret_cast(def->uri)); - if(Material *mat = bind.material()) - { - // Update existing. - App_Materials().rebuild(*mat, def); - } + // Update existing. + Material &material = App_Materials().find(*reinterpret_cast(def->uri)).material(); + App_Materials().rebuild(material, def); } + catch(Materials::Manifest::MissingMaterialError const&) + {} // Ignore this error. catch(Materials::NotFoundError const &) { // A new Material. @@ -1436,7 +1435,7 @@ static void initMaterialGroup(ded_group_t *def) try { - Material *mat = App_Materials().find(*reinterpret_cast(gm->material)).material(); + Material &material = App_Materials().find(*reinterpret_cast(gm->material)).material(); if(def->flags & AGF_PRECACHE) // A precache group. { @@ -1446,7 +1445,7 @@ static void initMaterialGroup(ded_group_t *def) groupNumber = App_Materials().newGroup(); } - App_Materials().group(groupNumber).addMaterial(*mat); + App_Materials().group(groupNumber).addMaterial(material); } #if 0 /// @todo $revise-texture-animation else // An animation group. @@ -1457,10 +1456,12 @@ static void initMaterialGroup(ded_group_t *def) animNumber = App_Materials().newAnimGroup(def->flags & ~AGF_PRECACHE); } - App_Materials().animGroup(animNumber).addFrame(*mat, gm->tics, gm->randomTics); + App_Materials().animGroup(animNumber).addFrame(material, gm->tics, gm->randomTics); } #endif } + catch(Materials::Manifest::MissingMaterialError const &) + {} // Ignore this error. catch(Materials::NotFoundError const &er) { // Log but otherwise ignore this error. diff --git a/doomsday/engine/src/edit_map.cpp b/doomsday/engine/src/edit_map.cpp index 9755c8d17b..e468341f6e 100644 --- a/doomsday/engine/src/edit_map.cpp +++ b/doomsday/engine/src/edit_map.cpp @@ -1809,7 +1809,7 @@ static void assignSurfaceMaterial(Surface *suf, ddstring_t const *materialUriStr // First try the preferred scheme, then any. try { - material = App_Materials().find(materialUri).material(); + material = &App_Materials().find(materialUri).material(); } catch(Materials::NotFoundError const &) { @@ -1817,7 +1817,7 @@ static void assignSurfaceMaterial(Surface *suf, ddstring_t const *materialUriStr try { materialUri.setScheme(""); - material = App_Materials().find(materialUri).material(); + material = &App_Materials().find(materialUri).material(); } catch(Materials::NotFoundError const &) {} diff --git a/doomsday/engine/src/map/p_dmu.cpp b/doomsday/engine/src/map/p_dmu.cpp index 21d8d297ab..e12ff66d69 100644 --- a/doomsday/engine/src/map/p_dmu.cpp +++ b/doomsday/engine/src/map/p_dmu.cpp @@ -362,7 +362,7 @@ void *P_ToPtr(int type, uint index) case DMU_MATERIAL: if(Materials::Manifest *manifest = App_Materials().toManifest(index)) { - return manifest->material(); + return &manifest->material(); } /// @todo Throw exception? return 0; @@ -529,7 +529,7 @@ int P_Callback(int type, uint index, void *context, int (*callback)(void *p, voi case DMU_MATERIAL: if(Materials::Manifest *manifest = App_Materials().toManifest(index)) { - return callback(manifest->material(), context); + return callback(&manifest->material(), context); } break; diff --git a/doomsday/engine/src/map/p_particle.cpp b/doomsday/engine/src/map/p_particle.cpp index c20a1555b4..1b25663b03 100644 --- a/doomsday/engine/src/map/p_particle.cpp +++ b/doomsday/engine/src/map/p_particle.cpp @@ -1395,7 +1395,7 @@ static int findDefForGenerator(ptcgen_t *gen, void *parameters) { try { - Material *defMat = App_Materials().find(*reinterpret_cast(def->material)).material(); + Material *defMat = &App_Materials().find(*reinterpret_cast(def->material)).material(); Material *mat = gen->plane->PS_material; if(def->flags & PGF_FLOOR_SPAWN) @@ -1422,6 +1422,8 @@ static int findDefForGenerator(ptcgen_t *gen, void *parameters) } #endif } + catch(Materials::Manifest::MissingMaterialError const &) + {} // Ignore this error. catch(Materials::NotFoundError const &) {} // Ignore this error. } diff --git a/doomsday/engine/src/map/r_world.cpp b/doomsday/engine/src/map/r_world.cpp index 76df28c835..e5ea3fdbe5 100644 --- a/doomsday/engine/src/map/r_world.cpp +++ b/doomsday/engine/src/map/r_world.cpp @@ -1409,7 +1409,7 @@ static Material *chooseFixMaterial(SideDef *s, SideDefSection section) if(choice2) return choice2; // We'll assign the special "missing" material... - return App_Materials().find(de::Uri("System", Path("missing"))).material(); + return &App_Materials().find(de::Uri("System", Path("missing"))).material(); } static void addMissingMaterial(SideDef *s, SideDefSection section) diff --git a/doomsday/engine/src/render/r_draw.cpp b/doomsday/engine/src/render/r_draw.cpp index 2fa115bf45..bda4a3875f 100644 --- a/doomsday/engine/src/render/r_draw.cpp +++ b/doomsday/engine/src/render/r_draw.cpp @@ -180,6 +180,7 @@ MaterialVariantSpec const &Ui_MaterialSpec() 0, -3, 0, false, false, false, false); } +/// @todo Optimize: Do not search for resources (materials, textures) each frame. void R_DrawViewBorder() { DENG_ASSERT(inited); @@ -215,16 +216,18 @@ void R_DrawViewBorder() glColor4f(1, 1, 1, 1); // View background. - Material *mat = App_Materials().find(*reinterpret_cast(borderGraphicsNames[BG_BACKGROUND])).material(); - if(mat) + try { - MaterialSnapshot const &ms = mat->prepare(Ui_MaterialSpec()); + MaterialSnapshot const &ms = App_Materials().find(*reinterpret_cast(borderGraphicsNames[BG_BACKGROUND])) + .material().prepare(Ui_MaterialSpec()); GL_BindTexture(reinterpret_cast(&ms.texture(MTU_PRIMARY))); GL_DrawCutRectf2Tiled(0, 0, port->geometry.size.width, port->geometry.size.height, ms.dimensions().width(), ms.dimensions().height(), 0, 0, vd->window.origin.x - border, vd->window.origin.y - border, vd->window.size.width + 2 * border, vd->window.size.height + 2 * border); } + catch(Materials::Manifest::MissingMaterialError const &) + {} // Ignore this error. if(border != 0) { diff --git a/doomsday/engine/src/render/r_things.cpp b/doomsday/engine/src/render/r_things.cpp index 9e11bdb1d3..a8c0b6c52c 100644 --- a/doomsday/engine/src/render/r_things.cpp +++ b/doomsday/engine/src/render/r_things.cpp @@ -212,7 +212,7 @@ static void buildSprite(TextureManifest &manifest) link = true; } - frame->mat = App_Materials().find(de::Uri("Sprites", manifest.path())).material(); + frame->mat = &App_Materials().find(de::Uri("Sprites", manifest.path())).material(); frame->frame[0] = frameNumber; frame->rotation[0] = rotationNumber; diff --git a/doomsday/engine/src/render/rend_console.cpp b/doomsday/engine/src/render/rend_console.cpp index ab648103ea..2820dcff05 100644 --- a/doomsday/engine/src/render/rend_console.cpp +++ b/doomsday/engine/src/render/rend_console.cpp @@ -290,14 +290,15 @@ void Rend_ConsoleUpdateBackground() DENG_ASSERT(inited); if(!consoleBackgroundMaterialUri || Str_IsEmpty(Uri_Path(consoleBackgroundMaterialUri))) return; + consoleBackgroundMaterial = 0; try { - consoleBackgroundMaterial = App_Materials().find(*reinterpret_cast(consoleBackgroundMaterialUri)).material(); + consoleBackgroundMaterial = &App_Materials().find(*reinterpret_cast(consoleBackgroundMaterialUri)).material(); } + catch(Materials::Manifest::MissingMaterialError const &) + {} // Ignore this error. catch(Materials::NotFoundError const &) - { - consoleBackgroundMaterial = 0; - } + {} // Ignore this error. } void Rend_ConsoleToggleFullscreen() diff --git a/doomsday/engine/src/render/rend_main.cpp b/doomsday/engine/src/render/rend_main.cpp index fcaa15c46c..de77f0f086 100644 --- a/doomsday/engine/src/render/rend_main.cpp +++ b/doomsday/engine/src/render/rend_main.cpp @@ -1443,7 +1443,7 @@ static void renderPlane(BspLeaf* bspLeaf, planetype_t type, coord_t height, else { Surface *suf = &bspLeaf->sector->planes[elmIdx]->surface; - Material *mat = suf->material? suf->material : App_Materials().find(de::Uri("System", Path("missing"))).material(); + Material *mat = suf->material? suf->material : &App_Materials().find(de::Uri("System", Path("missing"))).material(); MaterialSnapshot const &ms = mat->prepare(Rend_MapSurfaceMaterialSpec()); params.glowing = ms.glowStrength(); @@ -1618,13 +1618,13 @@ static boolean rendHEdgeSection(HEdge* hedge, SideDefSection section, if(renderTextures == 2) { // Lighting debug mode; render using System:gray. - mat = App_Materials().find(de::Uri("System", Path("gray"))).material(); + mat = &App_Materials().find(de::Uri("System", Path("gray"))).material(); } else if(!surface->material || ((surface->inFlags & SUIF_FIX_MISSING_MATERIAL) && devNoTexFix)) { // Missing material debug mode; render using System:missing. - mat = App_Materials().find(de::Uri("System", Path("missing"))).material(); + mat = &App_Materials().find(de::Uri("System", Path("missing"))).material(); } else { @@ -2741,10 +2741,10 @@ static void Rend_RenderPlanes() else if(texMode == 1) // For debug, render the "missing" texture instead of the texture // chosen for surfaces to fix the HOMs. - mat = App_Materials().find(de::Uri("System", Path("missing"))).material(); + mat = &App_Materials().find(de::Uri("System", Path("missing"))).material(); else // For lighting debug, render all solid surfaces using the gray texture. - mat = App_Materials().find(de::Uri("System", Path("gray"))).material(); + mat = &App_Materials().find(de::Uri("System", Path("gray"))).material(); V2f_Copy(texOffset, suf->visOffset); // Add the Y offset to orient the Y flipped texture. @@ -3900,7 +3900,7 @@ static void Rend_RenderBoundingBoxes() glDisable(GL_CULL_FACE); MaterialSnapshot const &ms = App_Materials(). - find(de::Uri("System", Path("bbox"))).material()->prepare(Rend_SpriteMaterialSpec()); + find(de::Uri("System", Path("bbox"))).material().prepare(Rend_SpriteMaterialSpec()); GL_BindTexture(reinterpret_cast(&ms.texture(MTU_PRIMARY))); GL_BlendMode(BM_ADD); diff --git a/doomsday/engine/src/render/rend_model.cpp b/doomsday/engine/src/render/rend_model.cpp index 4b26a972a6..49f0e634db 100644 --- a/doomsday/engine/src/render/rend_model.cpp +++ b/doomsday/engine/src/render/rend_model.cpp @@ -1136,13 +1136,11 @@ static void Mod_RenderSubModel(uint number, rendmodelparams_t const *parm) if(renderTextures == 2) { // For lighting debug, render all surfaces using the gray texture. - Material *mat = App_Materials().find(de::Uri("System", Path("gray"))).material(); - DENG_ASSERT(mat); - MaterialVariantSpec const &spec = App_Materials().variantSpecForContext(MC_MODELSKIN, 0, 0, 0, 0, GL_REPEAT, GL_REPEAT, 1, -2, -1, true, true, false, false); - MaterialSnapshot const &ms = mat->prepare(spec); + MaterialSnapshot const &ms = + App_Materials().find(de::Uri("System", Path("gray"))).material().prepare(spec); skinTexture = &ms.texture(MTU_PRIMARY); } diff --git a/doomsday/engine/src/render/sky.cpp b/doomsday/engine/src/render/sky.cpp index ddb580a17e..baeafaa126 100644 --- a/doomsday/engine/src/render/sky.cpp +++ b/doomsday/engine/src/render/sky.cpp @@ -166,14 +166,15 @@ static void configureDefaultSky() { skylayer_t *layer = &skyLayers[i]; layer->flags = (i == 0? SLF_ACTIVE : 0); + layer->material = 0; try { - layer->material = App_Materials().find(de::Uri(DEFAULT_SKY_SPHERE_MATERIAL, RC_NULL)).material(); + layer->material = &App_Materials().find(de::Uri(DEFAULT_SKY_SPHERE_MATERIAL, RC_NULL)).material(); } + catch(Materials::Manifest::MissingMaterialError const &) + {} // Ignore this error. catch(Materials::NotFoundError const &) - { - layer->material = 0; - } + {} // Ignore this error. layer->offset = DEFAULT_SKY_SPHERE_XOFFSET; layer->fadeoutLimit = DEFAULT_SKY_SPHERE_FADEOUT_LIMIT; } @@ -294,11 +295,8 @@ void Sky_Configure(ded_sky_t *def) { try { - Material *mat = App_Materials().find(*reinterpret_cast(sl->material)).material(); - if(mat) - { - Sky_LayerSetMaterial(i, mat); - } + Material *mat = &App_Materials().find(*reinterpret_cast(sl->material)).material(); + Sky_LayerSetMaterial(i, mat); } catch(Materials::NotFoundError const &er) { @@ -797,14 +795,14 @@ static void configureRenderHemisphereStateForLayer(int layer, hemispherecap_t se if(renderTextures == 2) { - mat = App_Materials().find(de::Uri("System", Path("gray"))).material(); + mat = &App_Materials().find(de::Uri("System", Path("gray"))).material(); } else { mat = Sky_LayerMaterial(layer); if(!mat) { - mat = App_Materials().find(de::Uri("System", Path("missing"))).material(); + mat = &App_Materials().find(de::Uri("System", Path("missing"))).material(); rs.texXFlip = false; } } diff --git a/doomsday/engine/src/render/sprite.cpp b/doomsday/engine/src/render/sprite.cpp index e966519146..51e1e9fad4 100644 --- a/doomsday/engine/src/render/sprite.cpp +++ b/doomsday/engine/src/render/sprite.cpp @@ -390,7 +390,7 @@ void Rend_DrawPSprite(rendpspriteparams_t const *params) { // For lighting debug, render all solid surfaces using the gray texture. MaterialSnapshot const &ms = - App_Materials().find(de::Uri("System", Path("gray"))).material()->prepare(PSprite_MaterialSpec()); + App_Materials().find(de::Uri("System", Path("gray"))).material().prepare(PSprite_MaterialSpec()); GL_BindTexture(reinterpret_cast(&ms.texture(MTU_PRIMARY))); glEnable(GL_TEXTURE_2D); @@ -872,7 +872,7 @@ static Material::Variant *chooseSpriteMaterial(rendspriteparams_t const &p) if(renderTextures == 2) { // For lighting debug, render all solid surfaces using the gray texture. - return App_Materials().find(de::Uri("System", Path("gray"))).material()->chooseVariant(Rend_SpriteMaterialSpec(), true); + return App_Materials().find(de::Uri("System", Path("gray"))).material().chooseVariant(Rend_SpriteMaterialSpec(), true); } // Use the pre-chosen sprite. diff --git a/doomsday/engine/src/resource/api_material.cpp b/doomsday/engine/src/resource/api_material.cpp index 07ebda543d..4d4b37b2c7 100644 --- a/doomsday/engine/src/resource/api_material.cpp +++ b/doomsday/engine/src/resource/api_material.cpp @@ -13,7 +13,7 @@ DENG_EXTERN_C Material *DD_MaterialForTextureUri(uri_s const *textureUri) { de::Uri uri = App_Textures()->find(reinterpret_cast(*textureUri)).composeUri(); uri.setScheme(DD_MaterialSchemeNameForTextureScheme(uri.scheme())); - return App_Materials().find(uri).material(); + return &App_Materials().find(uri).material(); } catch(de::Materials::UnknownSchemeError const &er) { diff --git a/doomsday/engine/src/resource/materialarchive.cpp b/doomsday/engine/src/resource/materialarchive.cpp index e6c4581726..15659bc08e 100644 --- a/doomsday/engine/src/resource/materialarchive.cpp +++ b/doomsday/engine/src/resource/materialarchive.cpp @@ -100,7 +100,7 @@ static Material *findRecordMaterial(Records &records, SerialId id) Material *material = 0; try { - material = App_Materials().find(Uri(records.stringRef(id), RC_NULL)).material(); + material = &App_Materials().find(Uri(records.stringRef(id), RC_NULL)).material(); } catch(Materials::NotFoundError const &) {} // Ignore this error. @@ -151,7 +151,7 @@ struct MaterialArchive::Instance { MaterialManifest *manifest = App_Materials().toManifest(i); SerialId id = insertRecord(manifest->composeUri()); - records.setUserPointer(id, manifest->material()); + records.setUserPointer(id, &manifest->material()); records.setUserValue(id, true); } } diff --git a/doomsday/engine/src/resource/materialmanifest.cpp b/doomsday/engine/src/resource/materialmanifest.cpp index 9b629f7e15..9c790ee37f 100644 --- a/doomsday/engine/src/resource/materialmanifest.cpp +++ b/doomsday/engine/src/resource/materialmanifest.cpp @@ -115,9 +115,19 @@ bool MaterialManifest::isCustom() const return d->isCustom; } -Material *MaterialManifest::material() const +bool MaterialManifest::hasMaterial() const { - return d->material; + return !!d->material; +} + +Material &MaterialManifest::material() const +{ + if(!d->material) + { + /// @throw MissingMaterialError The manifest is not presently associated with a material. + throw MissingMaterialError("MaterialManifest::material", "Missing required material"); + } + return *d->material; } void MaterialManifest::setMaterial(Material *newMaterial) @@ -148,36 +158,24 @@ void MaterialManifest::clearDefinitionLinks() ded_detailtexture_t *MaterialManifest::detailTextureDef() const { - if(!d->material) - { - /// @throw MissingMaterialError A material is required for this. - throw MissingMaterialError("MaterialManifest::detailTextureDef", "Missing required material"); - } - if(isDedicated) return 0; // We must prepare a variant before we can determine which definition is in effect. - d->material->prepare(Rend_MapSurfaceMaterialSpec()); + material().prepare(Rend_MapSurfaceMaterialSpec()); - byte prepared = d->material->prepared(); + byte prepared = material().prepared(); if(prepared) return d->defs.detailtextures[prepared - 1]; return 0; } ded_reflection_t *MaterialManifest::reflectionDef() const { - if(!d->material) - { - /// @throw MissingMaterialError A material is required for this. - throw MissingMaterialError("MaterialManifest::reflectionDef", "Missing required material"); - } - if(isDedicated) return 0; // We must prepare a variant before we can determine which definition is in effect. - d->material->prepare(Rend_MapSurfaceMaterialSpec()); + material().prepare(Rend_MapSurfaceMaterialSpec()); - byte prepared = d->material->prepared(); + byte prepared = material().prepared(); if(prepared) return d->defs.reflections[prepared - 1]; return 0; } diff --git a/doomsday/engine/src/resource/materials.cpp b/doomsday/engine/src/resource/materials.cpp index 91846432ae..47f0705554 100644 --- a/doomsday/engine/src/resource/materials.cpp +++ b/doomsday/engine/src/resource/materials.cpp @@ -338,7 +338,8 @@ void Materials::rebuild(Material &material, ded_material_t *def) for(uint i = 0; i < d->manifestCount; ++i) { Manifest *manifest = d->manifestIdMap[i]; - if(!manifest || manifest->material() != &material) continue; + if(!manifest || !manifest->hasMaterial()) continue; + if(&manifest->material() != &material) continue; manifest->linkDefinitions(); } @@ -514,10 +515,10 @@ Material *Materials::newFromDef(ded_material_t &def) try { manifest = &find(uri); - if(manifest->material()) + if(manifest->hasMaterial()) { LOG_DEBUG("A Material with uri \"%s\" already exists, returning existing.") << uri; - return manifest->material(); + return &manifest->material(); } } catch(NotFoundError const &) @@ -815,7 +816,7 @@ static void printMaterialInfo(Material &material) static void printMaterialSummary(Materials::Manifest &manifest, bool printSchemeName = true) { - Material *material = manifest.material(); + Material *material = manifest.hasMaterial()? &manifest.material() : 0; Uri uri = manifest.composeUri(); QByteArray path = printSchemeName? uri.asText().toUtf8() : QByteArray::fromPercentEncoding(uri.path().toStringRef().toUtf8()); @@ -1078,9 +1079,9 @@ D_CMD(InspectMaterial) try { de::Materials::Manifest &manifest = materials.find(search); - if(Material *mat = manifest.material()) + if(manifest.hasMaterial()) { - de::printMaterialInfo(*mat); + de::printMaterialInfo(manifest.material()); } else { diff --git a/doomsday/engine/src/ui/finaleinterpreter.cpp b/doomsday/engine/src/ui/finaleinterpreter.cpp index 62339e6337..f88cec3bc3 100644 --- a/doomsday/engine/src/ui/finaleinterpreter.cpp +++ b/doomsday/engine/src/ui/finaleinterpreter.cpp @@ -1338,22 +1338,24 @@ DEFFC(End) DEFFC(BGMaterial) { // First attempt to resolve as a Values URI (which defines the material URI). - de::Materials::Manifest *manifest = 0; + Material *material = 0; try { + de::Materials::Manifest *manifest = 0; if(ded_value_t* value = Def_GetValueByUri(OP_URI(0))) { - manifest = &App_Materials().find(de::Uri(value->text, RC_NULL)); + material = &App_Materials().find(de::Uri(value->text, RC_NULL)).material(); } else { - manifest = &App_Materials().find(*reinterpret_cast(OP_URI(0))); + material = &App_Materials().find(*reinterpret_cast(OP_URI(0))).material(); } } + catch(de::Materials::Manifest::MissingMaterialError const &) + {} // Ignore this error. catch(de::Materials::NotFoundError const &) {} // Ignore this error. - Material *material = manifest? manifest->material() : 0; changePageBackground(fi->_pages[PAGE_PICS], material); }