ENH:add "volume selection" checkbox
jira: none Change-Id: I68b5f54e37ea2ab9e2b65ac84abc834060f400df
This commit is contained in:
parent
94d1d62340
commit
eec7de441b
|
@ -8376,7 +8376,7 @@ float GLCanvas3D::_show_assembly_tooltip_information(float caption_max, float x,
|
|||
}
|
||||
|
||||
//BBS
|
||||
void GLCanvas3D::_render_assemble_control() const
|
||||
void GLCanvas3D::_render_assemble_control()
|
||||
{
|
||||
if (m_canvas_type != ECanvasType::CanvasAssembleView) {
|
||||
GLVolume::explosion_ratio = m_explosion_ratio = 1.0;
|
||||
|
@ -8397,7 +8397,7 @@ void GLCanvas3D::_render_assemble_control() const
|
|||
const float text_padding = 7.0f;
|
||||
const float text_size_x = std::max(imgui->calc_text_size(_L("Reset direction")).x + 2 * ImGui::GetStyle().FramePadding.x,
|
||||
std::max(imgui->calc_text_size(_L("Explosion Ratio")).x, imgui->calc_text_size(_L("Section View")).x));
|
||||
const float slider_width = 75.0f;
|
||||
const float slider_width = 60.0f;
|
||||
const float value_size = imgui->calc_text_size("3.00").x + text_padding * 2;
|
||||
const float item_spacing = imgui->get_item_spacing().x;
|
||||
ImVec2 window_padding = ImGui::GetStyle().WindowPadding;
|
||||
|
@ -8418,6 +8418,7 @@ void GLCanvas3D::_render_assemble_control() const
|
|||
float get_cur_y = pos.y - ImGui::GetFrameHeight() - 4 * text_y;
|
||||
tip_icon_size =_show_assembly_tooltip_information(caption_max, get_cur_x, get_cur_y);
|
||||
}
|
||||
float same_line_width = tip_icon_size;
|
||||
{
|
||||
float clp_dist = m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position();
|
||||
if (clp_dist == 0.f) {
|
||||
|
@ -8431,32 +8432,76 @@ void GLCanvas3D::_render_assemble_control() const
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SameLine(tip_icon_size + window_padding.x + text_size_x + item_spacing);
|
||||
same_line_width += (text_size_x + item_spacing);
|
||||
ImGui::SameLine(same_line_width);
|
||||
ImGui::PushItemWidth(slider_width);
|
||||
bool view_slider_changed = imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true);
|
||||
|
||||
ImGui::SameLine(tip_icon_size +window_padding.x + text_size_x + slider_width + item_spacing * 2);
|
||||
same_line_width += (slider_width + item_spacing);
|
||||
ImGui::SameLine(same_line_width);
|
||||
ImGui::PushItemWidth(value_size);
|
||||
bool view_input_changed = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||
|
||||
if (view_slider_changed || view_input_changed)
|
||||
m_gizmos.m_assemble_view_data->model_objects_clipper()->set_position(clp_dist, true);
|
||||
}
|
||||
|
||||
same_line_width += (value_size + item_spacing * 2);
|
||||
}
|
||||
{
|
||||
ImGui::SameLine(tip_icon_size +window_padding.x + text_size_x + slider_width + item_spacing * 6 + value_size);
|
||||
auto temp_x = imgui->calc_text_size(_L("Explosion Ratio")).x;
|
||||
ImGui::SameLine(same_line_width);
|
||||
ImGui::PushItemWidth(temp_x);
|
||||
imgui->text(_L("Explosion Ratio"));
|
||||
|
||||
ImGui::SameLine(tip_icon_size +window_padding.x + 2 * text_size_x + slider_width + item_spacing * 7 + value_size);
|
||||
same_line_width += (temp_x + item_spacing);
|
||||
ImGui::SameLine(same_line_width);
|
||||
ImGui::PushItemWidth(slider_width);
|
||||
bool explosion_slider_changed = imgui->bbl_slider_float_style("##ratio_slider", &m_explosion_ratio, 1.0f, 3.0f, "%1.2f");
|
||||
|
||||
ImGui::SameLine(tip_icon_size +window_padding.x + 2 * text_size_x + 2 * slider_width + item_spacing * 8 + value_size);
|
||||
same_line_width += (slider_width + item_spacing);
|
||||
ImGui::SameLine(same_line_width);
|
||||
ImGui::PushItemWidth(value_size);
|
||||
bool explosion_input_changed = ImGui::BBLDragFloat("##ratio_input", &m_explosion_ratio, 0.1f, 1.0f, 3.0f, "%1.2f");
|
||||
same_line_width += (value_size + item_spacing*2);
|
||||
}
|
||||
{
|
||||
ImGui::SameLine(same_line_width);
|
||||
// input
|
||||
std::vector<std::string> modes = {_u8L("Object"), _u8L("Part")};
|
||||
int selection_idx = m_selection.get_volume_selection_mode() == Selection::Instance ? 0 : 1;
|
||||
auto label = _u8L("Selection Mode") + ":" ;
|
||||
auto label_width = imgui->calc_text_size(label).x ;
|
||||
auto item_width = imgui->calc_text_size(_u8L("Object")).x * 2.5 + imgui->calc_text_size("xx").x+ item_spacing;
|
||||
//render imgui
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::PushItemWidth(label_width);
|
||||
imgui->text(label);
|
||||
same_line_width += (label_width + item_spacing);
|
||||
ImGui::SameLine(same_line_width);
|
||||
ImGui::PushItemWidth(item_width);
|
||||
size_t selection_out = selection_idx;
|
||||
const char *selected_str = (selection_idx >= 0 && selection_idx < int(modes.size())) ? modes[selection_idx].c_str() : "";
|
||||
ImGuiWrapper::push_combo_style(get_scale());
|
||||
if (ImGui::BBLBeginCombo(("##" + label).c_str(), selected_str, 0)) {
|
||||
for (size_t line_idx = 0; line_idx < modes.size(); ++line_idx) {
|
||||
ImGui::PushID(int(line_idx));
|
||||
if (ImGui::Selectable("", line_idx == selection_idx))
|
||||
selection_out = line_idx;
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("%s", modes[line_idx].c_str());
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGuiWrapper::pop_combo_style();
|
||||
if (selection_idx != selection_out) {//do
|
||||
if (selection_out == 0) { m_selection.unlock_volume_selection_mode(); }
|
||||
m_selection.set_volume_selection_mode(selection_out == 1 ? Selection::Volume : Selection::Instance);
|
||||
if (selection_out == 1) { m_selection.lock_volume_selection_mode(); }
|
||||
}
|
||||
same_line_width += (label_width + item_width);
|
||||
}
|
||||
imgui->end();
|
||||
|
||||
ImGuiWrapper::pop_toolbar_style();
|
||||
|
|
|
@ -1152,7 +1152,7 @@ private:
|
|||
//void _render_view_toolbar() const;
|
||||
void _render_paint_toolbar() const;
|
||||
float _show_assembly_tooltip_information(float caption_max, float x, float y) const;
|
||||
void _render_assemble_control() const;
|
||||
void _render_assemble_control();
|
||||
void _render_assemble_info() const;
|
||||
#if ENABLE_SHOW_CAMERA_TARGET
|
||||
void _render_camera_target() const;
|
||||
|
|
|
@ -181,7 +181,7 @@ private:
|
|||
const Transform3d& get_instance_scale_matrix() const { return m_instance.scale_matrix; }
|
||||
const Transform3d& get_instance_mirror_matrix() const { return m_instance.mirror_matrix; }
|
||||
const Transform3d &get_instance_full_matrix() const { return m_instance.full_tran.get_matrix(); }
|
||||
|
||||
|
||||
const Geometry::Transformation &get_volume_transform() const { return m_volume.full_tran; }
|
||||
const Geometry::Transformation &get_instance_transform() const { return m_instance.full_tran; }
|
||||
};
|
||||
|
@ -431,6 +431,7 @@ public:
|
|||
//BBS: add partplate related logic
|
||||
void notify_instance_update(int object_idx, int instance_idx);
|
||||
// BBS
|
||||
EMode get_volume_selection_mode(){ return m_volume_selection_mode;}
|
||||
void set_volume_selection_mode(EMode mode) { if (!m_volume_selection_locked) m_volume_selection_mode = mode; }
|
||||
void lock_volume_selection_mode() { m_volume_selection_locked = true; }
|
||||
void unlock_volume_selection_mode() { m_volume_selection_locked = false; }
|
||||
|
|
Loading…
Reference in New Issue