Skip to content

Commit

Permalink
MegaMolGraph: feed projet directory to FilePathParams of newly create…
Browse files Browse the repository at this point in the history
…d modules
  • Loading branch information
geringsj committed May 19, 2022
1 parent fbd805d commit f4f8076
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/MegaMolGraph.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "mmcore/MegaMolGraph.h"
#include "mmcore/AbstractSlot.h"
#include "mmcore/param/ButtonParam.h"
#include "mmcore/param/FilePathParam.h"
#include "mmcore/utility/log/Log.h"
#include "mmcore/view/AbstractView_EventConsumption.h"
#include "stdafx.h"
Expand Down Expand Up @@ -523,6 +524,16 @@ bool megamol::core::MegaMolGraph::add_module(ModuleInstantiationRequest_t const&
// the current project directory path
if (m_current_project_path->attributes.has_value()) {
auto project_directory_path = m_current_project_path->attributes.value().project_directory;

for (auto child = module_ptr->ChildList_Begin(); child != module_ptr->ChildList_End(); ++child) {
auto ps = dynamic_cast<param::ParamSlot*>((*child).get());
if (ps != nullptr) {
auto p = ps->Param<param::FilePathParam>();
if (p != nullptr) {
p->SetProjectDirectory(project_directory_path);
}
}
}
}

const auto create_module = [module_description, module_ptr](auto& module_lifetime_dependencies) {
Expand Down

0 comments on commit f4f8076

Please sign in to comment.