Skip to content

Commit

Permalink
Add Data bool to run the manager process if it is active
Browse files Browse the repository at this point in the history
  • Loading branch information
epernod committed Mar 29, 2023
1 parent 01645fd commit 6f8e8af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/InfinyToolkit/CarvingTools/AdvancedCarvingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ AdvancedCarvingManager::AdvancedCarvingManager()
: d_toolModelPath( initData(&d_toolModelPath, "toolModelPath", "Tool model path"))
, d_surfaceModelPath( initData(&d_surfaceModelPath, "surfaceModelPath", "TriangleSetModel or SphereModel path"))
, d_active( initData(&d_active, false, "active", "Activate this object.\nNote that this can be dynamically controlled by using a key") )
, d_process(initData(&d_process, false, "process", "Will perform the carving according to filter done in active mode"))
, d_carvingWithBurning(initData(&d_carvingWithBurning, true, "carvingWithBurning", "Activate this object.\nNote that this can be dynamically controlled by using a key"))
, d_carvingWithRefinement(initData(&d_carvingWithRefinement, false, "carvingWithRefinement", "Activate this object.\nNote that this can be dynamically controlled by using a key"))
, d_cuttingMode(initData(&d_cuttingMode, false, "cuttingMode", "Activate the option tetrahedral cutting."))
Expand Down Expand Up @@ -347,13 +348,7 @@ void AdvancedCarvingManager::filterCollision()
for (auto carvingPerformer : m_carvingPerformer)
{
carvingPerformer->filterContacts();
}

//// process the collision
//for (auto carvingPerformer : m_carvingPerformer)
//{
// carvingPerformer->runPerformer();
//}
}
}


Expand All @@ -377,14 +372,20 @@ void AdvancedCarvingManager::handleEvent(sofa::core::objectmodel::Event* event)
{
if (ev->getKey() == 'C')
{
msg_warning() << "Burn, baby burn!";
//d_active.setValue(true);
for (auto carvingPerformer : m_carvingPerformer)
{
carvingPerformer->runPerformer();
}
d_process.setValue(true);
}
}

if (d_process.getValue())
{
for (auto carvingPerformer : m_carvingPerformer)
{
carvingPerformer->runPerformer();
}

d_process.setValue(false);
}

}

void AdvancedCarvingManager::draw(const core::visual::VisualParams* vparams)
Expand Down
1 change: 1 addition & 0 deletions src/InfinyToolkit/CarvingTools/AdvancedCarvingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class SOFA_INFINYTOOLKIT_API AdvancedCarvingManager : public core::behavior::Bas
Data < std::string > d_surfaceModelPath;

Data < bool > d_active;
Data < bool > d_process;
Data < bool > d_carvingWithBurning;
Data < bool > d_carvingWithRefinement;
Data < bool > d_cuttingMode;
Expand Down

0 comments on commit 6f8e8af

Please sign in to comment.