Skip to content

Commit

Permalink
VOXEDIT: fixed brush panel setting the select brush options
Browse files Browse the repository at this point in the history
... in the wrong brush (the shape brush)
  • Loading branch information
mgerhardy committed Aug 15, 2024
1 parent 73483b0 commit 8c1b7c3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tools/voxedit/modules/voxedit-ui/BrushPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void BrushPanel::updateLineBrushPanel(command::CommandExecutionListener &listene

void BrushPanel::updateSelectBrushPanel(command::CommandExecutionListener &listener) {
Modifier &modifier = _sceneMgr->modifier();
ShapeBrush &brush = modifier.shapeBrush();
SelectBrush &brush = modifier.selectBrush();
aabbBrushOptions(listener, brush);
aabbBrushModeOptions(brush);
}
Expand Down
5 changes: 5 additions & 0 deletions src/tools/voxedit/modules/voxedit-util/modifier/Modifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class Modifier : public core::IComponent {
PathBrush &pathBrush();
PaintBrush &paintBrush();
BrushContext &brushContext();
SelectBrush &selectBrush();
const BrushContext &brushContext() const;

/**
Expand Down Expand Up @@ -241,6 +242,10 @@ inline PaintBrush &Modifier::paintBrush() {
return _paintBrush;
}

inline SelectBrush &Modifier::selectBrush() {
return _selectBrush;
}

inline int Modifier::gridResolution() const {
return _brushContext.gridResolution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ namespace voxedit {
void SelectBrush::generate(scenegraph::SceneGraph &sceneGraph, ModifierVolumeWrapper &wrapper, const BrushContext &ctx,
const voxel::Region &region) {
// TODO: this doesn't work for preview
_selectionManager->select(wrapper, region.getLowerCorner(), region.getUpperCorner());
voxel::Region selectionRegion = region;
if (_brushClamping) {
selectionRegion.cropTo(ctx.targetVolumeRegion);
}
_selectionManager->select(wrapper, selectionRegion.getLowerCorner(), selectionRegion.getUpperCorner());
}

} // namespace voxedit
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SelectBrush : public AABBBrush {
public:
SelectBrush(SelectionManager *selectionManager)
: Super(BrushType::Select, ModifierType::Select, ModifierType::Select), _selectionManager(selectionManager) {
setBrushClamping(true);
}
virtual ~SelectBrush() = default;
};
Expand Down

0 comments on commit 8c1b7c3

Please sign in to comment.