]> git.tdb.fi Git - libs/gl.git/commitdiff
Adjust naming of instances in Scene loader
authorMikko Rasa <tdb@tdb.fi>
Thu, 14 Oct 2021 09:00:27 +0000 (12:00 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 14 Oct 2021 09:00:27 +0000 (12:00 +0300)
I'm going to add inline nested scenes so a per-loader counter would get
duplicates.

source/render/scene.cpp
source/render/scene.h

index 75d1859bdd4995d8c42d8c0aa6f4b9ca747d7928..4b7aee1a8574499b59c169b976fd34cf7dc22feb 100644 (file)
@@ -89,10 +89,11 @@ Scene::GenericLoader::TypeRegistry &Scene::get_scene_registry()
 }
 
 
+unsigned Scene::Loader::inline_counter = 0;
+
 Scene::Loader::Loader(Scene &s, Collection &c, ContentMap *m):
        DataFile::CollectionObjectLoader<Scene>(s, &c),
-       content(m),
-       inst_counter(0)
+       content(m)
 {
        add("object", &Loader::object);
        add("object", &Loader::object_tagged);
@@ -108,7 +109,7 @@ void Scene::Loader::object_tagged(const string &n, const string &t)
 {
        RefPtr<ObjectInstance> inst = new ObjectInstance(get_collection().get<GL::Object>(n));
        load_sub(*inst);
-       get_collection().add(format("%s/%d.inst", FS::basename(get_source()), inst_counter++), inst.get());
+       get_collection().add(format("_scene_object_%d.inst", ++inline_counter), inst.get());
        if(content && !t.empty())
                (*content)[t] = inst.get();
        obj.add(*inst.release());
index 8083239390fed6d765e546ae08ea2aadde14f2ce..96ecee97ef559f7f15ff6b4595b7c92046ae25ba 100644 (file)
@@ -25,7 +25,8 @@ protected:
 
        private:
                ContentMap *content;
-               unsigned inst_counter;
+
+               static unsigned inline_counter;
 
        public:
                Loader(Scene &s, Collection &c): Loader(s, c, 0) { }