NAP
Public Member Functions | Public Attributes | List of all members
ParameterGUI Class Reference

#include <parametergui.h>

Public Member Functions

 ParameterGUI (nap::Core &core)
 
void show (bool newWindow=true)
 
bool load (std::string preset, utility::ErrorState &errorState)
 
int getSelectedPresetIndex () const
 
const std::string & getSelectedPreset () const
 
virtual bool init (utility::ErrorState &errorState) override
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

bool mSerializable = true
 Property: 'Serializable' if the group, including child groups, is a preset that can be saved and loaded using this GUI. More...
 
ResourcePtr< nap::ParameterGroupmParameterGroup = nullptr
 Property: 'Group' Which parameter group to show, including all child groups. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Shows an ImGUI window that can be used to edit/load/save parameters of a specific group. The GUI is created by (recursively) traversing the parameters in a group and creating appropriate UI elements for each parameter.

The editor that is used to create the UI element for a given parameter type can be customized, allowing for custom types to be displayed in the UI. Call nap::ParameterGUIService() to register your own editor. Default UI elements are provided for built-in types such as int, float, etc.

Inheritance diagram for ParameterGUI:
[legend]
Collaboration diagram for ParameterGUI:
[legend]

Constructor & Destructor Documentation

◆ ParameterGUI()

ParameterGUI ( nap::Core core)

Member Function Documentation

◆ getSelectedPreset()

const std::string& getSelectedPreset ( ) const

Returns the currently selected preset if one was selected, asserts false otherwise

Returns
the the currently selected preset if one was selected

◆ getSelectedPresetIndex()

int getSelectedPresetIndex ( ) const

Returns the index of the currently selected preset if one was selected, returns -1 otherwise

Returns
the index of the currently selected preset if one was selected, -1 otherwise

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initializes the parameter GUI

Parameters
errorStatecontains the error if initialization failed
Returns
if initialization succeeded

Reimplemented from Object.

◆ load()

bool load ( std::string  preset,
utility::ErrorState errorState 
)

Load a preset programmatically

Parameters
presetthe filename of the preset to load
errorStatecontains the error if the preset load failed
Returns
if the preset loaded successfully

◆ show()

void show ( bool  newWindow = true)

Display all parameters, including parameters in child groups, as UI elements. Should be called each frame on update(). When 'newWindow' is set to true a new window will be created. When 'newWindow' is disabled the parameters will be added to the currently active GUI window.

Parameters
newWindowif the parameters should be added to a new window.

Member Data Documentation

◆ mParameterGroup

ResourcePtr<nap::ParameterGroup> mParameterGroup = nullptr

Property: 'Group' Which parameter group to show, including all child groups.

◆ mSerializable

bool mSerializable = true

Property: 'Serializable' if the group, including child groups, is a preset that can be saved and loaded using this GUI.