... | @@ -125,7 +125,7 @@ public: |
... | @@ -125,7 +125,7 @@ public: |
|
};
|
|
};
|
|
```
|
|
```
|
|
|
|
|
|
### Settings Interface <a name="settings></a>
|
|
### Settings Interface <a name="settings"></a>
|
|
|
|
|
|
The interface of `EnumerableSettingsInterface` is the following:
|
|
The interface of `EnumerableSettingsInterface` is the following:
|
|
|
|
|
... | @@ -171,9 +171,12 @@ public: |
... | @@ -171,9 +171,12 @@ public: |
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
A printing parameter in IceSL is represented by the nested class `SettingInterface`, its interface is fairly straightforward.
|
|
A printing parameter in IceSL is represented by the nested class `SettingInterface`, its interface is fairly straightforward:
|
|
|
|
|
|
```c++
|
|
```c++
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
class SettingInterface
|
|
class SettingInterface
|
|
{
|
|
{
|
|
public:
|
|
public:
|
... | @@ -220,85 +223,50 @@ A printing parameter in IceSL is represented by the nested class `SettingInterfa |
... | @@ -220,85 +223,50 @@ A printing parameter in IceSL is represented by the nested class `SettingInterfa |
|
...
|
|
...
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Finally, to query or add a printing parameter, the interface is as follows:
|
|
|
|
|
|
```c++
|
|
```c++
|
|
virtual std::unique_ptr<SettingInterface> getSettingByName(const std::string& internalName) const = 0;
|
|
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
// Gets a setting by its internal name. For a complete list of internal names
|
|
|
|
// and their descriptions (english, spanish and french) please refer to
|
|
|
|
// https://icesl.loria.fr/parameters/
|
|
|
|
virtual std::unique_ptr<SettingInterface> getSettingByName(
|
|
|
|
const std::string& internalName // setting's internal name
|
|
|
|
) const = 0;
|
|
|
|
|
|
|
|
// Adds a setting specific to the plugin to IceSL's setting panel.
|
|
template<typename T> std::unique_ptr<SettingInterface> addSettingFromPlugin(
|
|
template<typename T> std::unique_ptr<SettingInterface> addSettingFromPlugin(
|
|
T* value, T* value_min, T* value_max,
|
|
T* value, T* value_min, T* value_max, // Default minimum and maximum value respectively.
|
|
const std::string& internalName,
|
|
const std::string& internalName, // Setting's internal name
|
|
const std::string& displayName,
|
|
const std::string& displayName, // Display (i.e., UI) name
|
|
const std::string& group,
|
|
const std::string& group, // Setting's group (e.g., slicing, supports, brush N, etc)
|
|
const std::string& description,
|
|
const std::string& description, // Setting's description tooltip
|
|
int rank,
|
|
int rank, // Order w.r.t. other settings (i.e., 0 = first)
|
|
std::function<bool()> active_if = std::function<bool()>(),
|
|
std::function<bool()> active_if = std::function<bool()>(), // visibility (i.e., shown) status
|
|
e_Units units = e_NoUnit,
|
|
e_Units units = e_NoUnit, // Setting's unit
|
|
e_Flags flags = e_NoFlag
|
|
e_Flags flags = e_NoFlag // Setting's flags
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// Same as 'addSettingFromPlugin' but the setting's type is a drop-down list selection
|
|
virtual std::unique_ptr<SettingInterface> addSelectionFromPlugin(
|
|
virtual std::unique_ptr<SettingInterface> addSelectionFromPlugin(
|
|
int* value,
|
|
int* value, // Default value (index of element in 'selections')
|
|
const std::string& internalName,
|
|
const std::string& internalName, // Setting's internal name
|
|
const std::vector<std::string>& selections,
|
|
const std::vector<std::string>& selections, // Possible selections of drop-down list
|
|
const std::string& displayName,
|
|
const std::string& displayName, // Display (i.e., UI) name
|
|
const std::string& group,
|
|
const std::string& group, // Setting's group (e.g., slicing, supports, brush N, etc)
|
|
const std::string& description,
|
|
const std::string& description, // Setting's description tooltip
|
|
int rank,
|
|
int rank, // Order w.r.t. other settings (i.e., 0 = first)
|
|
void(*selection_callback)(void*) = nullptr,
|
|
void(*selection_callback)(void*) = nullptr, // C-style callback function when selection changes
|
|
void* userdata = nullptr,
|
|
void* userdata = nullptr, // Parameter to callback
|
|
std::function<bool()> active_if = std::function<bool()>(),
|
|
std::function<bool()> active_if = std::function<bool()>(), // visibility (i.e., shown) status
|
|
e_Units units = e_NoUnit,
|
|
e_Units units = e_NoUnit, // Setting's unit
|
|
e_Flags flags = e_NoFlag
|
|
e_Flags flags = e_NoFlag // Setting's flags
|
|
) = 0;
|
|
) = 0;
|
|
|
|
|
|
|
|
// Gets the number of available brushes and printing extruders respectively.
|
|
virtual int getNumberOfBrushes() const;
|
|
virtual int getNumberOfBrushes() const;
|
|
virtual int getNumberOfExtruders() const;
|
|
virtual int getNumberOfExtruders() const;
|
|
```
|
|
``` |
|
|
|
\ No newline at end of file |
|
|
|
|
|
|
|
|
|
- ```bool isConstantSetting()```, ```bool isPerLayerSetting()``` and ```bool isFieldSetting()```
|
|
|
|
|
|
|
|
.
|
|
|
|
|
|
|
|
- ```getValue(bool& value)```, ```getValue(int& value)```, ```getValue(float& value)``` and ```getValue(std::string& value)```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- ```setValue(bool value)```, ```setValue(int value)```, ```setValue(float value)``` and ```setValue(std::string value)```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- ```e_Type getType()```, ```e_Units getUnits()``` and ```e_Flags getFlags()```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- ```double valueAtHeight(double h)``` and ```double valueAtPosition(v3f pos)```
|
|
|
|
|
|
|
|
|
|
|
|
To either get or add a printing setting from IceSL, we have the following functions:
|
|
|
|
|
|
|
|
- ```std::unique_ptr<SettingInterface> getSettingByName(const std::string& internalName)```
|
|
|
|
|
|
|
|
Gets a setting through its internal name `internalName`. For a complete list of internal names and their descriptions (english, spanish and french) please refer to [ https://icesl.loria.fr/parameters/](https://icesl.loria.fr/parameters/)
|
|
|
|
|
|
|
|
- ```std::unique_ptr<SettingInterface> addSettingFromPlugin(T* value, T* value_min, T* value_max, const std::string& internalName, const std::string& displayName, const std::string& group, const std::string& description, int rank, std::function<bool()> active_if = std::function<bool()>(), e_Units units = e_NoUnit, e_Flags flags = e_NoFlag);```
|
|
|
|
|
|
|
|
Adds a setting specific to the plugin with internal name `internalName`, display name (i.e., UI) `displayName`, setting group (e.g., slicing, supports, brush N, etc) `group`, description text `description`, order w.r.t. other settings (i.e., 0 = first) `rank`, active status (through a lambda function called by IceSL) `active_if`, units `units` and flags `flags`. `value` is the default value, `value_min` and `value_max` are the setting's min and max values respectively and al three should match the type of the setting.
|
|
|
|
|
|
|
|
```
|
|
|
|
std::unique_ptr<SettingInterface> addSelectionFromPlugin(
|
|
|
|
int* value,
|
|
|
|
const std::string& internalName,
|
|
|
|
const std::vector<std::string>& selections,
|
|
|
|
const std::string& displayName,
|
|
|
|
const std::string& group,
|
|
|
|
const std::string& description,
|
|
|
|
int rank,
|
|
|
|
void(*selection_callback)(void*) = nullptr,
|
|
|
|
void* userdata = nullptr,
|
|
|
|
std::function<bool()> active_if = std::function<bool()>(),
|
|
|
|
e_Units units = e_NoUnit, e_Flags flags = e_NoFlag);
|
|
|
|
```
|
|
|
|
|
|
|
|
Same as `addSettingFromPlugin` but `value` refers to an element of `selections` by index and `selection_callback` is a C-style function callback whenever the setting is changed with structure `userdata` as parameter to this callback. |
|
|
|
\ No newline at end of file |
|
|