From 8b07819ba7715c1fa9292d5868f44b9ee9c23dec Mon Sep 17 00:00:00 2001 From: Fabian Paus <fabian.paus@kit.edu> Date: Mon, 3 Jan 2022 16:09:33 +0100 Subject: [PATCH] ArViz: Add interaction flag for global axes --- source/RobotAPI/components/ArViz/Client/Client.h | 5 +++++ .../components/ArViz/Client/elements/ElementOps.h | 12 ++++++++++++ source/RobotAPI/interface/ArViz/Elements.ice | 9 ++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/source/RobotAPI/components/ArViz/Client/Client.h b/source/RobotAPI/components/ArViz/Client/Client.h index 20d209ba0..fd9f81d8c 100644 --- a/source/RobotAPI/components/ArViz/Client/Client.h +++ b/source/RobotAPI/components/ArViz/Client/Client.h @@ -95,6 +95,11 @@ namespace viz // TODO: Implement } + void commit(Layer const& layer) + { + commit({layer}); + } + void commit(std::vector<Layer> const& layers) { data::LayerUpdateSeq updates; diff --git a/source/RobotAPI/components/ArViz/Client/elements/ElementOps.h b/source/RobotAPI/components/ArViz/Client/elements/ElementOps.h index fb3f4b81a..a1a8ce949 100644 --- a/source/RobotAPI/components/ArViz/Client/elements/ElementOps.h +++ b/source/RobotAPI/components/ArViz/Client/elements/ElementOps.h @@ -59,6 +59,18 @@ namespace armarx::viz return selection(); } + Self& globalAxes(bool global = true) + { + if (global) + { + data_.enableFlags |= data::InteractionEnableFlags::GLOBAL_AXES; + } + else + { + data_.enableFlags &= ~data::InteractionEnableFlags::GLOBAL_AXES; + } + } + Self& fullTransform() { return translation().rotation(); diff --git a/source/RobotAPI/interface/ArViz/Elements.ice b/source/RobotAPI/interface/ArViz/Elements.ice index 550f75bbf..e37954367 100644 --- a/source/RobotAPI/interface/ArViz/Elements.ice +++ b/source/RobotAPI/interface/ArViz/Elements.ice @@ -33,16 +33,23 @@ module data { const int NONE = 0; + // Make an object selectable const int SELECT = 1; + // Enable the context menu for an object const int CONTEXT_MENU = 2; + // Enable translation along the three axes const int TRANSLATION_X = 4; const int TRANSLATION_Y = 8; const int TRANSLATION_Z = 16; + // Enable rotation along the three axes const int ROTATION_X = 32; const int ROTATION_Y = 64; const int ROTATION_Z = 128; + + // Are the axes global (1) or object local (0)? + const int GLOBAL_AXES = 256; }; struct InteractionDescription @@ -92,7 +99,7 @@ module data long revision = 0; // Chosen context menu entry is only relevant for type == CONTEXT_MENU_CHOSEN - string chosenContextMenuEntry; + int chosenContextMenuEntry = 0; // Original and chosen poase are only relevant for type == TRANSFORM GlobalPose originalPose; -- GitLab