WarningTexture class in GLCanvas3D modified so it can be used more universally

Added a warning to notify that some objects are not rendered with SLA gizmo active
This commit is contained in:
Lukas Matena 2019-02-20 12:09:45 +01:00
parent 9a8a9bac28
commit 2759c87e5b
2 changed files with 70 additions and 44 deletions

View file

@ -843,18 +843,32 @@ private:
class WarningTexture : public GUI::GLTexture
{
public:
WarningTexture();
enum Warning {
ObjectOutside,
ToolpathOutside,
SomethingNotShown
};
// Sets a warning of the given type to be active/inactive. If several warnings are active simultaneously,
// only the last one is shown (decided by the order in the enum above).
void activate(WarningTexture::Warning warning, bool state, const GLCanvas3D& canvas);
void render(const GLCanvas3D& canvas) const;
private:
static const unsigned char Background_Color[3];
static const unsigned char Opacity;
int m_original_width;
int m_original_height;
public:
WarningTexture();
// Information about which warnings are currently active.
std::vector<Warning> m_warnings;
bool generate(const std::string& msg, const GLCanvas3D& canvas);
void render(const GLCanvas3D& canvas) const;
// Generates the texture with given text.
bool _generate(const std::string& msg, const GLCanvas3D& canvas);
};
class LegendTexture : public GUI::GLTexture
@ -1003,7 +1017,6 @@ public:
bool is_reload_delayed() const;
void enable_layers_editing(bool enable);
void enable_warning_texture(bool enable);
void enable_legend_texture(bool enable);
void enable_picking(bool enable);
void enable_moving(bool enable);
@ -1189,8 +1202,7 @@ private:
void _generate_legend_texture(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);
// generates a warning texture containing the given message
void _generate_warning_texture(const std::string& msg);
void _reset_warning_texture();
void _set_warning_texture(WarningTexture::Warning warning, bool state);
bool _is_any_volume_outside() const;