Skip to content

Commit 3c4a3d1

Browse files
fix command line loading of bvh files
1 parent 2c404ef commit 3c4a3d1

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

src/OpenCOVER/plugins/hlrs/LamurePointCloud/Lamure.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

src/OpenCOVER/plugins/hlrs/LamurePointCloud/Lamure.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class Lamure : public opencover::coVRPlugin, public opencover::ui::Owner
298298
osg::ref_ptr<osg::Group> getGroup() { return m_lamure_grp; }
299299

300300
private:
301-
std::string m_file_to_load;
301+
std::vector<std::string> m_files_to_load;
302302
bool m_reload_imminent = false;
303303
int m_frames_to_wait = 0;
304304

0 commit comments

Comments
 (0)