From: Mikko Rasa Date: Wed, 6 Oct 2021 21:04:37 +0000 (+0300) Subject: Fix loading of inline materials and lights X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5a01404e40717c6c2cc389ed8357713e1f216f07;p=libs%2Fgl.git Fix loading of inline materials and lights --- diff --git a/source/materials/lighting.cpp b/source/materials/lighting.cpp index 3057d20d..f6bb39ff 100644 --- a/source/materials/lighting.cpp +++ b/source/materials/lighting.cpp @@ -144,9 +144,8 @@ void Lighting::Loader::light_inline() { Light::GenericLoader ldr(get_collection()); load_sub_with(ldr); - RefPtr lgt = ldr.get_object(); - get_collection().add(format("%s/%d.light", FS::basename(get_source()), obj.lights.size()), lgt.get()); - obj.attach(*lgt.release()); + Light *lgt = ldr.store_object(get_collection(), format("%s/%d.light", FS::basename(get_source()), obj.lights.size())); + obj.attach(*lgt); } } // namespace GL diff --git a/source/materials/rendermethod.cpp b/source/materials/rendermethod.cpp index 35c24c1f..05319758 100644 --- a/source/materials/rendermethod.cpp +++ b/source/materials/rendermethod.cpp @@ -160,9 +160,7 @@ void RenderMethod::Loader::material_inline() { Material::GenericLoader ldr(get_collection()); load_sub_with(ldr); - RefPtr mat = ldr.get_object(); - get_collection().add(inline_base_name+".mat", mat.get()); - obj.material = mat.release(); + obj.material = ldr.store_object(get_collection(), inline_base_name+".mat"); obj.set_material_textures(); }