mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 17:15:53 +08:00
Text object has no option to change type in emboss window
This commit is contained in:
parent
02b39d7282
commit
b46df99d42
@ -628,6 +628,9 @@ void GLGizmoEmboss::on_render() {
|
|||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prevent get local coordinate system on multi volumes
|
||||||
|
if (!selection.is_single_volume_or_modifier() &&
|
||||||
|
!selection.is_single_volume_instance()) return;
|
||||||
bool is_surface_dragging = m_temp_transformation.has_value();
|
bool is_surface_dragging = m_temp_transformation.has_value();
|
||||||
// Do NOT render rotation grabbers when dragging object
|
// Do NOT render rotation grabbers when dragging object
|
||||||
bool is_rotate_by_grabbers = m_dragging;
|
bool is_rotate_by_grabbers = m_dragging;
|
||||||
@ -727,7 +730,6 @@ void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fix width - showing scroll in first draw of advanced.
|
|
||||||
const ImVec2 &min_window_size = get_minimal_window_size();
|
const ImVec2 &min_window_size = get_minimal_window_size();
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, min_window_size);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, min_window_size);
|
||||||
|
|
||||||
@ -767,6 +769,14 @@ void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
} else {
|
} else {
|
||||||
ImGui::PopStyleVar(); // WindowMinSize
|
ImGui::PopStyleVar(); // WindowMinSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// after change volume from object to volume it is necessary to recalculate
|
||||||
|
// minimal windows size because of set type
|
||||||
|
if (m_should_set_minimal_windows_size) {
|
||||||
|
m_should_set_minimal_windows_size = false;
|
||||||
|
ImGui::SetWindowSize(ImVec2(0.f, min_window_size.y), ImGuiCond_Always);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
if (!is_opened)
|
if (!is_opened)
|
||||||
close();
|
close();
|
||||||
@ -926,13 +936,17 @@ void GLGizmoEmboss::initialize()
|
|||||||
float input_height = line_height_with_spacing + 2*style.FramePadding.y;
|
float input_height = line_height_with_spacing + 2*style.FramePadding.y;
|
||||||
float tree_header = line_height_with_spacing;
|
float tree_header = line_height_with_spacing;
|
||||||
float separator_height = 1 + style.FramePadding.y;
|
float separator_height = 1 + style.FramePadding.y;
|
||||||
|
|
||||||
|
// "Text is to object" + radio buttons
|
||||||
|
cfg.height_of_volume_type_selector = separator_height + line_height_with_spacing + input_height;
|
||||||
|
|
||||||
float window_height =
|
float window_height =
|
||||||
window_title + // window title
|
window_title + // window title
|
||||||
cfg.text_size.y + // text field
|
cfg.text_size.y + // text field
|
||||||
input_height * 5 + // type Radios + style selector + font name + height + depth
|
input_height * 4 + // font name + height + depth + style selector
|
||||||
tree_header + // advance tree
|
tree_header + // advance tree
|
||||||
2 * separator_height + // separator lines
|
separator_height + // presets separator line
|
||||||
2 * line_height_with_spacing + // "Text is to object" + "Presets"
|
line_height_with_spacing + // "Presets"
|
||||||
2 * style.WindowPadding.y;
|
2 * style.WindowPadding.y;
|
||||||
float window_width = cfg.input_offset + cfg.input_width + 2*style.WindowPadding.x
|
float window_width = cfg.input_offset + cfg.input_width + 2*style.WindowPadding.x
|
||||||
+ 2 * (cfg.icon_width + space);
|
+ 2 * (cfg.icon_width + space);
|
||||||
@ -1098,6 +1112,13 @@ bool GLGizmoEmboss::set_volume(ModelVolume *volume)
|
|||||||
act_style.path = path;
|
act_style.path = path;
|
||||||
act_style.type = WxFontUtils::get_actual_type();
|
act_style.type = WxFontUtils::get_actual_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The change of volume could show or hide part with setter on volume type
|
||||||
|
if (m_volume == nullptr ||
|
||||||
|
(m_volume->get_object()->volumes.size() == 1) !=
|
||||||
|
(volume->get_object()->volumes.size() == 1)){
|
||||||
|
m_should_set_minimal_windows_size = true;
|
||||||
|
}
|
||||||
|
|
||||||
m_text = tc.text;
|
m_text = tc.text;
|
||||||
m_volume = volume;
|
m_volume = volume;
|
||||||
@ -1398,9 +1419,11 @@ void GLGizmoEmboss::draw_window()
|
|||||||
|
|
||||||
draw_style_list();
|
draw_style_list();
|
||||||
|
|
||||||
ImGui::Separator();
|
// Do not select volume type, when it is text object
|
||||||
|
if (m_volume->get_object()->volumes.size() != 1) {
|
||||||
draw_model_type();
|
ImGui::Separator();
|
||||||
|
draw_model_type();
|
||||||
|
}
|
||||||
|
|
||||||
m_imgui->disabled_end(); // !is_active_font
|
m_imgui->disabled_end(); // !is_active_font
|
||||||
|
|
||||||
@ -3227,11 +3250,20 @@ void GLGizmoEmboss::set_minimal_window_size(bool is_advance_edit_style)
|
|||||||
ImGuiCond_Always);
|
ImGuiCond_Always);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImVec2 &GLGizmoEmboss::get_minimal_window_size() const
|
ImVec2 GLGizmoEmboss::get_minimal_window_size() const
|
||||||
{
|
{
|
||||||
return (!m_is_advanced_edit_style) ? m_gui_cfg->minimal_window_size :
|
ImVec2 res;
|
||||||
((!m_style_manager.has_collections())? m_gui_cfg->minimal_window_size_with_advance :
|
if (!m_is_advanced_edit_style)
|
||||||
m_gui_cfg->minimal_window_size_with_collections);
|
res = m_gui_cfg->minimal_window_size;
|
||||||
|
else if (!m_style_manager.has_collections())
|
||||||
|
res = m_gui_cfg->minimal_window_size_with_advance;
|
||||||
|
else
|
||||||
|
res = m_gui_cfg->minimal_window_size_with_collections;
|
||||||
|
|
||||||
|
bool is_object = m_volume->get_object()->volumes.size() == 1;
|
||||||
|
if (!is_object)
|
||||||
|
res.y += m_gui_cfg->height_of_volume_type_selector;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ALLOW_ADD_FONT_BY_OS_SELECTOR
|
#ifdef ALLOW_ADD_FONT_BY_OS_SELECTOR
|
||||||
|
@ -146,8 +146,9 @@ private:
|
|||||||
template<typename T, typename Draw>
|
template<typename T, typename Draw>
|
||||||
bool revertible(const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, float undo_offset, Draw draw);
|
bool revertible(const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, float undo_offset, Draw draw);
|
||||||
|
|
||||||
|
bool m_should_set_minimal_windows_size = false;
|
||||||
void set_minimal_window_size(bool is_advance_edit_style);
|
void set_minimal_window_size(bool is_advance_edit_style);
|
||||||
const ImVec2 &get_minimal_window_size() const;
|
ImVec2 get_minimal_window_size() const;
|
||||||
|
|
||||||
// process mouse event
|
// process mouse event
|
||||||
bool on_mouse_for_rotation(const wxMouseEvent &mouse_event);
|
bool on_mouse_for_rotation(const wxMouseEvent &mouse_event);
|
||||||
@ -171,10 +172,11 @@ private:
|
|||||||
ImVec2 minimal_window_size = ImVec2(0, 0);
|
ImVec2 minimal_window_size = ImVec2(0, 0);
|
||||||
ImVec2 minimal_window_size_with_advance = ImVec2(0, 0);
|
ImVec2 minimal_window_size_with_advance = ImVec2(0, 0);
|
||||||
ImVec2 minimal_window_size_with_collections = ImVec2(0, 0);
|
ImVec2 minimal_window_size_with_collections = ImVec2(0, 0);
|
||||||
float input_width = 0.f;
|
float height_of_volume_type_selector = 0.f;
|
||||||
float delete_pos_x = 0.f;
|
float input_width = 0.f;
|
||||||
float max_style_name_width = 0.f;
|
float delete_pos_x = 0.f;
|
||||||
unsigned int icon_width = 0;
|
float max_style_name_width = 0.f;
|
||||||
|
unsigned int icon_width = 0;
|
||||||
|
|
||||||
// maximal width and height of style image
|
// maximal width and height of style image
|
||||||
Vec2i max_style_image_size = Vec2i(0, 0);
|
Vec2i max_style_image_size = Vec2i(0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user