@@ -251,7 +251,7 @@ int Lamure::loadBvh(const char *filename, osg::Group *parent, const char *)
251251
252252 // If not loaded, and plugin is initialized, trigger async reload
253253 if (plugin->initialized ) {
254- plugin->m_file_to_load = file;
254+ plugin->m_files_to_load . push_back ( file) ;
255255 plugin->m_reload_imminent = true ;
256256 plugin->m_frames_to_wait = 3 ; // Wait 3 frames
257257 plugin->m_renderer ->detachCallbacks ();
@@ -313,6 +313,8 @@ bool Lamure::init2() {
313313 }
314314 m_settings.num_models = N;
315315
316+ // lamure::ren::model_database::get_instance()->apply();
317+
316318 m_ui->setupUi ();
317319 m_renderer->init ();
318320
@@ -763,19 +765,31 @@ void Lamure::preFrame() {
763765 lamure::ren::cut_database::get_instance ()->reset ();
764766 }
765767
766- // settings and visibility
768+ if (m_files_to_load.empty ()) {
769+ m_reload_imminent = false ;
770+ return ;
771+ }
772+
767773 auto & models = m_settings.models ;
768- models.push_back (m_file_to_load);
769- const uint16_t newIdx = static_cast <uint16_t >(models.size () - 1 );
774+ for (const auto & file_to_load : m_files_to_load) {
775+ bool found = false ;
776+ for (const auto & existing_model : models) {
777+ if (existing_model == file_to_load) {
778+ found = true ;
779+ break ;
780+ }
781+ }
782+ if (!found) {
783+ models.push_back (file_to_load);
784+ }
785+ }
786+ m_files_to_load.clear ();
770787
771788 {
772789 std::lock_guard<std::mutex> lock (g_settings_mutex);
773790 if (m_settings.model_visible .size () < models.size ()) {
774791 m_settings.model_visible .resize (models.size (), true );
775792 }
776- else {
777- m_settings.model_visible [newIdx] = true ;
778- }
779793 }
780794
781795 m_model_idx.clear (); m_model_info.model_transformations .clear ();
0 commit comments