MeshLib C++ Docs
Loading...
Searching...
No Matches
MRPythonUiInteraction.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <optional>
5#include <string>
6#include <utility>
7#include <vector>
8
9namespace MR::PythonViewer
10{
11
22
23struct UiEntry
24{
25 std::string name;
27 std::string status;
28};
29
31{
32 std::int64_t value = 0;
33 std::int64_t min = 0;
34 std::int64_t max = 0;
35};
36
38{
39 std::uint64_t value = 0;
40 std::uint64_t min = 0;
41 std::uint64_t max = 0;
42};
43
45{
46 double value = 0;
47 double min = 0;
48 double max = 0;
49};
50
52{
53 std::string value;
54 std::optional<std::vector<std::string>> allowed;
55};
56
58
63[[nodiscard]] std::vector<UiEntry> _uiListEntries( const std::vector<std::string>& path );
64
68[[nodiscard]] std::vector<std::pair<std::vector<std::string>, UiEntry>> _uiListAllEntries( const std::vector<std::string>& rootPath );
69
71void uiPressButton( const std::vector<std::string>& path );
72
74[[nodiscard]] UiValueInt uiReadValueInt( const std::vector<std::string>& path );
75
77[[nodiscard]] UiValueUint uiReadValueUint( const std::vector<std::string>& path );
78
80[[nodiscard]] UiValueReal uiReadValueReal( const std::vector<std::string>& path );
81
83[[nodiscard]] UiValueString uiReadValueString( const std::vector<std::string>& path );
84
86void uiWriteValue( const std::vector<std::string>& path, std::int64_t value );
87
89void uiWriteValue( const std::vector<std::string>& path, std::uint64_t value );
90
92void uiWriteValue( const std::vector<std::string>& path, double value );
93
95void uiWriteValue( const std::vector<std::string>& path, const std::string& value );
96
97}
Definition MRPythonScene.h:19
UiValueReal uiReadValueReal(const std::vector< std::string > &path)
Read a value from a drag/slider widget. This function is for real numbers.
UiValueUint uiReadValueUint(const std::vector< std::string > &path)
Read a value from a drag/slider widget. This function is for unsigned integers.
UiEntryType
UI entry type enum.
Definition MRPythonUiInteraction.h:14
@ valueString
Definition MRPythonUiInteraction.h:20
@ valueUint
Definition MRPythonUiInteraction.h:18
@ valueInt
Definition MRPythonUiInteraction.h:17
@ button
Definition MRPythonUiInteraction.h:15
@ group
Definition MRPythonUiInteraction.h:16
@ valueReal
Definition MRPythonUiInteraction.h:19
void uiPressButton(const std::vector< std::string > &path)
Simulate a button click. Use uiListEntries() to find button names.
UiValueString uiReadValueString(const std::vector< std::string > &path)
Read a value from a drag/slider widget. This function is for strings.
UiValueInt uiReadValueInt(const std::vector< std::string > &path)
Read a value from a drag/slider widget. This function is for signed integers.
std::vector< UiEntry > _uiListEntries(const std::vector< std::string > &path)
python_viewer.py wraps the functions with a leading underscore, to return lists and tuples.
std::vector< std::pair< std::vector< std::string >, UiEntry > > _uiListAllEntries(const std::vector< std::string > &rootPath)
void uiWriteValue(const std::vector< std::string > &path, std::int64_t value)
Write a value to a drag/slider widget. This overload is for signed integers.
Definition MRPythonUiInteraction.h:24
UiEntryType type
Definition MRPythonUiInteraction.h:26
std::string status
Definition MRPythonUiInteraction.h:27
std::string name
Definition MRPythonUiInteraction.h:25
Definition MRPythonUiInteraction.h:31
std::int64_t value
Definition MRPythonUiInteraction.h:32
std::int64_t max
Definition MRPythonUiInteraction.h:34
std::int64_t min
Definition MRPythonUiInteraction.h:33
Definition MRPythonUiInteraction.h:45
double min
Definition MRPythonUiInteraction.h:47
double max
Definition MRPythonUiInteraction.h:48
double value
Definition MRPythonUiInteraction.h:46
Definition MRPythonUiInteraction.h:52
std::optional< std::vector< std::string > > allowed
Definition MRPythonUiInteraction.h:54
std::string value
Definition MRPythonUiInteraction.h:53
Definition MRPythonUiInteraction.h:38
std::uint64_t min
Definition MRPythonUiInteraction.h:40
std::uint64_t max
Definition MRPythonUiInteraction.h:41
std::uint64_t value
Definition MRPythonUiInteraction.h:39