This allows to integrate AntTweakBar with VTK, providing a quick and easy way to add small user interfaces to VTK applications.
- AntTweakBar
- VTK >=7.0.0
- CMake >= 2.8
A demo application can be found in the directory demo
.
This eventually needs to be made into a proper cmake module. As of now, there are two possiblities to build vtkAntTweakBar:
- Add
src/vtkAntTweakBar.cpp
to your sources - Add the
include
directory to your include path
Add the entire vtkAntTweakBar tree as subdirectory and add these lines to your CMakeLists.txt
:
include_directories("${PROJECT_SOURCE_DIR}/vtkAntTweakBar/include")
add_subdirectory("${PROJECT_SOURCE_DIR}/vtkAntTweakBar")
After setting up your VTK render window interactor (called renderWindowInteractor
here), create a vtkAntTweakBar
object and setup anttweakbar as follows:
#include <AntTweakBar.h>
#include "vtkAntTweakBar.hpp"
// ...
auto twCallback = vtkSmartPointer<vtkAntTweakBar>::New();
twCallback->Initialize(renderWindowInteractor);
// Setup your TweakBars here
TwBar* bar = TwNewBar("TweakBar");
TwAddVarCB(...);
...
renderWindowInteractor->Start();
- Set this up as a cmake module
- Add methods to hide/show AntTweakBar
- Add tests
- VTK Widgets that capture input will always get preference over AntTweakBar
- vtkAntTweakBar will listen to the render window's RenderEvent for drawing AntTweakBar. If you do any rendering on your own using this event, make sure to not mess up the rendering order
- AntTweakBar expects
TwDraw
to be called in the event loop, while VTK only redraws if there was a change. By default, vtkAntTweakBar will callrenderWindow->Render()
only when an event (keyboard/mouse input) was handled by AntTweakBar. If you want to change this to render on any event (e.g. when the user moves the mouse outside of a TweakBar), callvtkAntTweakBar::EnableAlwaysRenderOnEvent()
.