Skip to content

Commit

Permalink
VOXEDIT: highlight the node aabb if the locked group is active
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerhardy committed Nov 14, 2024
1 parent e43445b commit 44248e0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/modules/scenegraph/SceneGraphNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ void SceneGraphNode::setVolume(const voxel::RawVolume *volume) {
_volume = (voxel::RawVolume *)volume;
}

bool SceneGraphNode::isLocked() const {
return _flags & Locked;
}

bool SceneGraphNode::isReference() const {
return _type == SceneGraphNodeType::ModelReference;
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/scenegraph/SceneGraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class SceneGraphNode {
void releaseOwnership();
bool owns() const;

bool isLocked() const;
bool isReference() const;
bool isReferenceable() const;
bool isAnyModelNode() const;
Expand Down
2 changes: 2 additions & 0 deletions src/modules/ui/IMGUIApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ void IMGUIApp::setColorTheme() {
const glm::vec4 &IMGUIApp::color(style::StyleColor color) {
const int style = _uistyle->intVal();
switch (color) {
case style::ColorLockedNode:
return core::Color::Red();
case style::ColorInactiveNode:
return core::Color::Gray();
case style::ColorGridBorder:
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ui/Style.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace style {

enum StyleColor { ColorReferenceNode, ColorInactiveNode, ColorActiveNode, ColorHighlightArea, ColorGridBorder, ColorBone, ColorUVEditor };
enum StyleColor { ColorLockedNode, ColorReferenceNode, ColorInactiveNode, ColorActiveNode, ColorHighlightArea, ColorGridBorder, ColorBone, ColorUVEditor };

const glm::vec4 &color(StyleColor color);

Expand Down
5 changes: 4 additions & 1 deletion src/tools/voxedit/modules/voxedit-util/SceneRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ void SceneRenderer::updateAABBMesh(bool sceneMode, const scenegraph::SceneGraph
}
core_trace_scoped(UpdateAABBMesh);
_shapeBuilder.clear();
const scenegraph::SceneGraphNode &activeNode = sceneGraph.node(sceneGraph.activeNode());
const bool activeNodeLocked = activeNode.isLocked();
for (auto entry : sceneGraph.nodes()) {
const scenegraph::SceneGraphNode &node = entry->second;
if (!node.isAnyModelNode()) {
Expand All @@ -211,6 +213,8 @@ void SceneRenderer::updateAABBMesh(bool sceneMode, const scenegraph::SceneGraph
}
if (node.id() == sceneGraph.activeNode()) {
continue;
} else if (activeNodeLocked && node.isLocked()) {
_shapeBuilder.setColor(style::color(style::ColorLockedNode));
} else if (node.isReference()) {
_shapeBuilder.setColor(style::color(style::ColorReferenceNode));
} else {
Expand All @@ -224,7 +228,6 @@ void SceneRenderer::updateAABBMesh(bool sceneMode, const scenegraph::SceneGraph
_shapeBuilder.obb(obb);
}

const scenegraph::SceneGraphNode &activeNode = sceneGraph.node(sceneGraph.activeNode());
if (activeNode.isAnyModelNode() && activeNode.visible()) {
_shapeBuilder.setColor(style::color(style::ColorActiveNode));
const voxel::RawVolume *v = sceneGraph.resolveVolume(activeNode);
Expand Down

0 comments on commit 44248e0

Please sign in to comment.