Merge branch 'master-remote' into feature/1.5

Signed-off-by: SoftFever <softfeverever@gmail.com>

# Conflicts:
#	bbl/i18n/BambuStudio.pot
#	bbl/i18n/de/BambuStudio_de.po
#	bbl/i18n/en/BambuStudio_en.po
#	bbl/i18n/es/BambuStudio_es.po
#	bbl/i18n/fr/BambuStudio_fr.po
#	bbl/i18n/hu/BambuStudio_hu.po
#	bbl/i18n/it/BambuStudio_it.po
#	bbl/i18n/nl/BambuStudio_nl.po
#	bbl/i18n/sv/BambuStudio_sv.po
#	bbl/i18n/zh_cn/BambuStudio_zh_CN.po
#	deps/Boost/Boost.cmake
#	deps/wxWidgets/wxWidgets.cmake
#	resources/config.json
#	resources/i18n/de/BambuStudio.mo
#	resources/i18n/en/BambuStudio.mo
#	resources/i18n/es/BambuStudio.mo
#	resources/i18n/fr/BambuStudio.mo
#	resources/i18n/hu/BambuStudio.mo
#	resources/i18n/it/BambuStudio.mo
#	resources/i18n/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/images/tips_arrow.svg
#	resources/profiles/Anycubic.json
#	resources/profiles/Anycubic/filament/Anycubic Generic ABS.json
#	resources/profiles/Anycubic/filament/Anycubic Generic ASA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PA-CF.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PC.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PETG.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PLA-CF.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PLA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PVA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic TPU.json
#	resources/profiles/Anycubic/filament/fdm_filament_common.json
#	resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json
#	resources/profiles/Anycubic/machine/Anycubic 4Max Pro.json
#	resources/profiles/Anycubic/process/0.20mm Standard @4MaxPro.json
#	resources/profiles/Anycubic/process/fdm_process_common.json
#	resources/profiles/BBL.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json
#	resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json
#	resources/profiles/Voron.json
#	resources/web/data/text.js
#	resources/web/image/printer/Anycubic 4Max Pro_cover.png
#	src/BambuStudio.cpp
#	src/libslic3r/GCode.cpp
#	src/libslic3r/GCode.hpp
#	src/libslic3r/GCode/GCodeProcessor.cpp
#	src/libslic3r/GCodeWriter.hpp
#	src/libslic3r/PerimeterGenerator.cpp
#	src/libslic3r/PresetBundle.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/Print.hpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
#	src/libslic3r/PrintObject.cpp
#	src/slic3r/GUI/AMSMaterialsSetting.cpp
#	src/slic3r/GUI/AMSMaterialsSetting.hpp
#	src/slic3r/GUI/AmsMappingPopup.cpp
#	src/slic3r/GUI/AmsMappingPopup.hpp
#	src/slic3r/GUI/Auxiliary.cpp
#	src/slic3r/GUI/BackgroundSlicingProcess.cpp
#	src/slic3r/GUI/ConfigManipulation.cpp
#	src/slic3r/GUI/DeviceManager.cpp
#	src/slic3r/GUI/DeviceManager.hpp
#	src/slic3r/GUI/ExtrusionCalibration.cpp
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GCodeViewer.hpp
#	src/slic3r/GUI/GUI_App.cpp
#	src/slic3r/GUI/IMSlider.cpp
#	src/slic3r/GUI/Jobs/PrintJob.cpp
#	src/slic3r/GUI/Jobs/PrintJob.hpp
#	src/slic3r/GUI/Jobs/SendJob.cpp
#	src/slic3r/GUI/Jobs/SendJob.hpp
#	src/slic3r/GUI/MainFrame.cpp
#	src/slic3r/GUI/MainFrame.hpp
#	src/slic3r/GUI/MediaPlayCtrl.cpp
#	src/slic3r/GUI/OptionsGroup.cpp
#	src/slic3r/GUI/PhysicalPrinterDialog.cpp
#	src/slic3r/GUI/Plater.cpp
#	src/slic3r/GUI/PrintHostDialogs.cpp
#	src/slic3r/GUI/Printer/BambuTunnel.h
#	src/slic3r/GUI/Printer/PrinterFileSystem.cpp
#	src/slic3r/GUI/Printer/gstbambusrc.c
#	src/slic3r/GUI/Printer/gstbambusrc.h
#	src/slic3r/GUI/ReleaseNote.cpp
#	src/slic3r/GUI/ReleaseNote.hpp
#	src/slic3r/GUI/SelectMachine.cpp
#	src/slic3r/GUI/SendToPrinter.cpp
#	src/slic3r/GUI/SetBedTypeDialog.cpp
#	src/slic3r/GUI/StatusPanel.cpp
#	src/slic3r/GUI/StatusPanel.hpp
#	src/slic3r/GUI/Tab.cpp
#	src/slic3r/GUI/Widgets/AMSControl.cpp
#	src/slic3r/GUI/Widgets/AMSControl.hpp
#	src/slic3r/GUI/Widgets/ImageSwitchButton.cpp
#	src/slic3r/GUI/Widgets/Label.cpp
#	src/slic3r/GUI/WipeTowerDialog.cpp
#	src/slic3r/Utils/Process.cpp
#	src/slic3r/Utils/bambu_networking.hpp
#	version.inc
This commit is contained in:
SoftFever 2023-03-08 00:08:26 +08:00
commit 5ef51f6c8a
339 changed files with 37169 additions and 5445 deletions

View file

@ -128,6 +128,29 @@ void GLGizmoFdmSupports::render_painter_gizmo() const
glsafe(::glDisable(GL_BLEND));
}
// BBS
bool GLGizmoFdmSupports::on_key_down_select_tool_type(int keyCode) {
switch (keyCode)
{
case 'F':
m_current_tool = ImGui::FillButtonIcon;
break;
case 'S':
m_current_tool = ImGui::SphereButtonIcon;
break;
case 'C':
m_current_tool = ImGui::CircleButtonIcon;
break;
case 'G':
m_current_tool = ImGui::GapFillIcon;
break;
default:
return false;
break;
}
return true;
}
// BBS
void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
{
@ -865,42 +888,22 @@ void GLGizmoFdmSupports::run_thread()
goto _finished;
}
if (m_is_tree_support)
if (!m_print_instance.print_object->support_layers().size())
{
if (!m_print_instance.print_object->tree_support_layers().size())
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ",no tree support layer found, update status to 100%\n";
print->set_status(100, L("Support Generated"));
goto _finished;
}
for (const TreeSupportLayer *support_layer : m_print_instance.print_object->tree_support_layers())
{
for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities)
{
_3DScene::extrusionentity_to_verts(extrusion_entity, float(support_layer->print_z), m_print_instance.shift, *m_support_volume);
}
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished extrusionentity_to_verts, update status to 100%";
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ",no support layer found, update status to 100%\n";
print->set_status(100, L("Support Generated"));
goto _finished;
}
else
for (const SupportLayer *support_layer : m_print_instance.print_object->support_layers())
{
if (!m_print_instance.print_object->support_layers().size())
for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ",no support layer found, update status to 100%\n";
print->set_status(100, L("Support Generated"));
goto _finished;
_3DScene::extrusionentity_to_verts(extrusion_entity, float(support_layer->print_z), m_print_instance.shift, *m_support_volume);
}
for (const SupportLayer *support_layer : m_print_instance.print_object->support_layers())
{
for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities)
{
_3DScene::extrusionentity_to_verts(extrusion_entity, float(support_layer->print_z), m_print_instance.shift, *m_support_volume);
}
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished extrusionentity_to_verts, update status to 100%";
print->set_status(100, L("Support Generated"));
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished extrusionentity_to_verts, update status to 100%";
print->set_status(100, L("Support Generated"));
record_timestamp();
}
catch (...) {

View file

@ -24,6 +24,9 @@ public:
state_ready
};
//BBS
bool on_key_down_select_tool_type(int keyCode);
protected:
void on_render_input_window(float x, float y, float bottom_limit) override;
std::string on_get_name() const override;

View file

@ -241,6 +241,34 @@ bool GLGizmoMmuSegmentation::on_number_key_down(int number)
return true;
}
bool GLGizmoMmuSegmentation::on_key_down_select_tool_type(int keyCode) {
switch (keyCode)
{
case 'F':
m_current_tool = ImGui::FillButtonIcon;
break;
case 'T':
m_current_tool = ImGui::TriangleButtonIcon;
break;
case 'S':
m_current_tool = ImGui::SphereButtonIcon;
break;
case 'C':
m_current_tool = ImGui::CircleButtonIcon;
break;
case 'H':
m_current_tool = ImGui::HeightRangeIcon;
break;
case 'G':
m_current_tool = ImGui::GapFillIcon;
break;
default:
return false;
break;
}
return true;
}
static void render_extruders_combo(const std::string &label,
const std::vector<std::string> &extruders,
const std::vector<std::array<float, 4>> &extruders_colors,

View file

@ -83,6 +83,7 @@ public:
// BBS
bool on_number_key_down(int number);
bool on_key_down_select_tool_type(int keyCode);
protected:
// BBS

View file

@ -261,7 +261,7 @@ protected:
static constexpr float CursorRadiusMin = 0.4f; // cannot be zero
static constexpr float CursorRadiusMax = 8.f;
static constexpr float CursorRadiusStep = 0.2f;
static constexpr float CursorHeightMin = 0.2f; // cannot be zero
static constexpr float CursorHeightMin = 0.1f; // cannot be zero
static constexpr float CursorHeightMax = 8.f;
static constexpr float CursorHeightStep = 0.2f;

View file

@ -226,10 +226,11 @@ void GLGizmoScale3D::on_render()
//draw connections
if (single_instance || single_volume) {
// BBS: when select multiple objects, uniform scale can be deselected, display the connection(4,5)
//if (single_instance || single_volume) {
glsafe(::glColor4fv(m_grabbers[4].color.data()));
render_grabbers_connection(4, 5);
}
//}
glsafe(::glColor4fv(m_grabbers[2].color.data()));
render_grabbers_connection(6, 7);

View file

@ -78,6 +78,23 @@ void GLGizmoSeam::render_painter_gizmo() const
glsafe(::glDisable(GL_BLEND));
}
// BBS
bool GLGizmoSeam::on_key_down_select_tool_type(int keyCode) {
switch (keyCode)
{
case 'S':
m_current_tool = ImGui::SphereButtonIcon;
break;
case 'C':
m_current_tool = ImGui::CircleButtonIcon;
break;
default:
return false;
break;
}
return true;
}
void GLGizmoSeam::render_triangles(const Selection& selection) const
{
ClippingPlaneDataWrapper clp_data = this->get_clipping_plane_data();

View file

@ -12,6 +12,9 @@ public:
void render_painter_gizmo() const override;
//BBS
bool on_key_down_select_tool_type(int keyCode);
protected:
// BBS
void on_set_state() override;

View file

@ -70,7 +70,7 @@ GLGizmoSimplify::GLGizmoSimplify(GLCanvas3D & parent,
{}
GLGizmoSimplify::~GLGizmoSimplify()
{
{
stop_worker_thread_request();
if (m_worker.joinable())
m_worker.join();
@ -173,10 +173,10 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
// Whether to trigger calculation after rendering is done.
bool start_process = false;
// Check selection of new volume
// Do not reselect object when processing
// Do not reselect object when processing
if (act_volume != m_volume) {
bool change_window_position = (m_volume == nullptr);
// select different model
@ -193,13 +193,13 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
// Start processing. If we switched from another object, process will
// stop the background thread and it will restart itself later.
start_process = true;
// set window position
if (m_move_to_center && change_window_position) {
m_move_to_center = false;
auto parent_size = m_parent.get_canvas_size();
auto parent_size = m_parent.get_canvas_size();
ImVec2 pos(parent_size.get_width() / 2 - m_gui_cfg->window_offset_x,
parent_size.get_height() / 2 - m_gui_cfg->window_offset_y);
parent_size.get_height() / 2 - m_gui_cfg->window_offset_y);
ImGui::SetNextWindowPos(pos, ImGuiCond_Always);
}else if (change_window_position) {
ImVec2 pos = ImGui::GetMousePos();
@ -212,7 +212,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
// maximal bottom right value
auto parent_size = m_parent.get_canvas_size();
ImVec2 br(
parent_size.get_width() - (2 * m_gui_cfg->window_offset_x + m_gui_cfg->window_padding),
parent_size.get_width() - (2 * m_gui_cfg->window_offset_x + m_gui_cfg->window_padding),
parent_size.get_height() - (2 * m_gui_cfg->window_offset_y + m_gui_cfg->window_padding));
if (pos.x > br.x) pos.x = br.x;
if (pos.y > br.y) pos.y = br.y;
@ -466,7 +466,7 @@ void GLGizmoSimplify::process()
m_worker.join();
}
// Copy configuration that will be used.
// Copy configuration that will be used.
m_state.config = m_configuration;
m_state.mv = m_volume;
m_state.status = State::running;
@ -542,11 +542,12 @@ void GLGizmoSimplify::apply_simplify() {
mv->set_mesh(std::move(*m_state.result));
m_state.result.reset();
mv->calculate_convex_hull();
mv->invalidate_convex_hull_2d();
mv->set_new_unique_id();
mv->get_object()->invalidate_bounding_box();
mv->get_object()->ensure_on_bed();
// fix hollowing, sla support points, modifiers, ...
// fix hollowing, sla support points, modifiers, ...
plater->changed_mesh(object_idx);
// Fix warning icon in object list
wxGetApp().obj_list()->update_item_error_icon(object_idx, -1);
@ -559,7 +560,7 @@ bool GLGizmoSimplify::on_is_activable() const
m_parent.get_selection().is_single_volume();
}
void GLGizmoSimplify::on_set_state()
void GLGizmoSimplify::on_set_state()
{
// Closing gizmo. e.g. selecting another one
if (GLGizmoBase::m_state == GLGizmoBase::Off) {
@ -574,12 +575,12 @@ void GLGizmoSimplify::on_set_state()
}
}
void GLGizmoSimplify::create_gui_cfg() {
void GLGizmoSimplify::create_gui_cfg() {
if (m_gui_cfg.has_value()) return;
int space_size = m_imgui->calc_text_size(":MM").x;
GuiCfg cfg;
cfg.top_left_width = std::max(m_imgui->calc_text_size(tr_mesh_name).x,
m_imgui->calc_text_size(tr_triangles).x)
m_imgui->calc_text_size(tr_triangles).x)
+ space_size;
const float radio_size = ImGui::GetFrameHeight();
@ -591,7 +592,7 @@ void GLGizmoSimplify::create_gui_cfg() {
cfg.input_width = cfg.bottom_left_width * 1.5;
cfg.window_offset_x = (cfg.bottom_left_width + cfg.input_width)/2;
cfg.window_offset_y = ImGui::GetTextLineHeightWithSpacing() * 5;
m_gui_cfg = cfg;
}
@ -605,7 +606,7 @@ void GLGizmoSimplify::request_rerender(bool force) {
}
void GLGizmoSimplify::set_center_position() {
m_move_to_center = true;
m_move_to_center = true;
}
@ -619,7 +620,7 @@ void GLGizmoSimplify::init_model(const indexed_triangle_set& its)
m_parent.toggle_model_objects_visibility(true); // selected volume may have changed
m_parent.toggle_model_objects_visibility(false, m_c->selection_info()->model_object(),
m_c->selection_info()->get_active_instance(), m_volume);
if (const Selection&sel = m_parent.get_selection(); sel.get_volume_idxs().size() == 1)
m_glmodel.set_color(-1, sel.get_volume(*sel.get_volume_idxs().begin())->color);
m_triangle_count = its.indices.size();

File diff suppressed because it is too large Load diff

View file

@ -4,13 +4,17 @@
#include "GLGizmoBase.hpp"
#include "slic3r/GUI/3DScene.hpp"
#include "../GLTexture.hpp"
#include "../Camera.hpp"
#include "libslic3r/Model.hpp"
namespace Slic3r {
enum class ModelVolumeType : int;
class ModelVolume;
namespace GUI {
enum class SLAGizmoEventType : unsigned char;
class GLGizmoText : public GLGizmoBase
{
private:
@ -22,10 +26,21 @@ private:
bool m_bold = true;
bool m_italic = false;
float m_thickness = 2.f;
float m_embeded_depth = 0.f;
float m_rotate_angle = 0;
float m_text_gap = 0.f;
bool m_is_surface_text = false;
bool m_keep_horizontal = false;
mutable RaycastResult m_rr;
float m_combo_height = 0.0f;
float m_combo_width = 0.0f;
float m_scale;
Vec2d m_mouse_position = Vec2d::Zero();
Vec2d m_origin_mouse_position = Vec2d::Zero();
bool m_shift_down = false;
class TextureInfo {
public:
GLTexture* texture { nullptr };
@ -38,18 +53,46 @@ private:
std::vector<TextureInfo> m_textures;
std::vector<std::string> m_font_names;
bool m_is_modify = false;
bool m_need_update_text = false;
int m_object_idx = -1;
int m_volume_idx = -1;
int m_preview_text_volume_id = -1;
Vec3d m_mouse_position_world = Vec3d::Zero();
Vec3d m_mouse_normal_world = Vec3d::Zero();
Vec3d m_cut_plane_dir = Vec3d::UnitZ();
std::vector<Vec3d> m_position_points;
std::vector<Vec3d> m_normal_points;
// This map holds all translated description texts, so they can be easily referenced during layout calculations
// etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect.
std::map<std::string, wxString> m_desc;
public:
GLGizmoText(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
~GLGizmoText();
void update_font_texture();
bool gizmo_event(SLAGizmoEventType action, const Vec2d &mouse_position, bool shift_down, bool alt_down, bool control_down);
bool is_mesh_point_clipped(const Vec3d &point, const Transform3d &trafo) const;
BoundingBoxf3 bounding_box() const;
protected:
virtual bool on_init() override;
virtual std::string on_get_name() const override;
virtual bool on_is_activable() const override;
virtual void on_render() override;
virtual void on_render_for_picking() override;
virtual void on_update(const UpdateData &data) override;
void push_combo_style(const float scale);
void pop_combo_style();
void push_button_style(bool pressed);
@ -57,6 +100,21 @@ protected:
virtual void on_set_state() override;
virtual CommonGizmosDataID on_get_requirements() const override;
virtual void on_render_input_window(float x, float y, float bottom_limit);
void show_tooltip_information(float x, float y);
private:
ModelVolume *get_selected_single_volume(int& out_object_idx, int& out_volume_idx) const;
void reset_text_info();
bool update_text_positions(const std::vector<std::string>& texts);
TriangleMesh get_text_mesh(const char* text_str, const Vec3d &position, const Vec3d &normal, const Vec3d &text_up_dir);
bool update_raycast_cache(const Vec2d &mouse_position, const Camera &camera, const std::vector<Transform3d> &trafo_matrices);
void generate_text_volume(bool is_temp = true);
void delete_temp_preview_text_volume();
TextInfo get_text_info();
void load_from_text_info(const TextInfo &text_info);
};
} // namespace GUI

View file

@ -405,11 +405,12 @@ void GLGizmosManager::update_data()
enable_grabber(Rotate, 0, !is_wipe_tower);
enable_grabber(Rotate, 1, !is_wipe_tower);
bool enable_scale_xyz = selection.is_single_full_instance() || selection.is_single_volume() || selection.is_single_modifier();
for (unsigned int i = 0; i < 6; ++i)
{
enable_grabber(Scale, i, enable_scale_xyz);
}
// BBS: when select multiple objects, uniform scale can be deselected, display the 0-5 grabbers
//bool enable_scale_xyz = selection.is_single_full_instance() || selection.is_single_volume() || selection.is_single_modifier();
//for (unsigned int i = 0; i < 6; ++i)
//{
// enable_grabber(Scale, i, enable_scale_xyz);
//}
if (m_common_gizmos_data) {
m_common_gizmos_data->update(get_current()
@ -624,6 +625,8 @@ bool GLGizmosManager::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_p
return dynamic_cast<GLGizmoSeam*>(m_gizmos[Seam].get())->gizmo_event(action, mouse_position, shift_down, alt_down, control_down);
else if (m_current == MmuSegmentation)
return dynamic_cast<GLGizmoMmuSegmentation*>(m_gizmos[MmuSegmentation].get())->gizmo_event(action, mouse_position, shift_down, alt_down, control_down);
else if (m_current == Text)
return dynamic_cast<GLGizmoText*>(m_gizmos[Text].get())->gizmo_event(action, mouse_position, shift_down, alt_down, control_down);
else
return false;
}
@ -756,7 +759,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
// mouse anywhere
if (evt.Moving()) {
m_tooltip = update_hover_state(mouse_pos);
if (m_current == MmuSegmentation || m_current == FdmSupports)
if (m_current == MmuSegmentation || m_current == FdmSupports || m_current == Text)
// BBS
gizmo_event(SLAGizmoEventType::Moving, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
} else if (evt.LeftUp()) {
@ -839,8 +842,8 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
//if (evt.AltDown())
// transformation_type.set_independent();
selection.scale(get_scale(), transformation_type);
//if (control_down)
// selection.translate(get_scale_offset(), true);
if (control_down && m_gizmos[m_current].get()->get_hover_id() < 6)
selection.translate(get_scale_offset(), true);
// BBS
//wxGetApp().obj_manipul()->set_dirty();
break;
@ -869,7 +872,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
m_tooltip.clear();
if (evt.LeftDown() && (!control_down || grabber_contains_mouse())) {
if ((m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation)
if ((m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation || m_current == Text)
&& gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown()))
// the gizmo got the event and took some action, there is no need to do anything more
processed = true;
@ -1181,10 +1184,40 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
processed = simplify->on_esc_key_down();
}
// BBS
else if (m_current == MmuSegmentation && keyCode > '0' && keyCode <= '9') {
else if (m_current == MmuSegmentation) {
GLGizmoMmuSegmentation* mmu_seg = dynamic_cast<GLGizmoMmuSegmentation*>(get_current());
if (mmu_seg != nullptr)
processed = mmu_seg->on_number_key_down(keyCode - '0');
if (mmu_seg != nullptr) {
if (keyCode > '0' && keyCode <= '9') {
processed = mmu_seg->on_number_key_down(keyCode - '0');
}
else if (keyCode == 'F' || keyCode == 'T' || keyCode == 'S' || keyCode == 'C' || keyCode == 'H' || keyCode == 'G') {
processed = mmu_seg->on_key_down_select_tool_type(keyCode);
if (processed) {
// force extra frame to automatically update window size
wxGetApp().imgui()->set_requires_extra_frame();
}
}
}
}
else if (m_current == FdmSupports) {
GLGizmoFdmSupports* fdm_support = dynamic_cast<GLGizmoFdmSupports*>(get_current());
if (fdm_support != nullptr && keyCode == 'F' || keyCode == 'S' || keyCode == 'C' || keyCode == 'G') {
processed = fdm_support->on_key_down_select_tool_type(keyCode);
}
if (processed) {
// force extra frame to automatically update window size
wxGetApp().imgui()->set_requires_extra_frame();
}
}
else if (m_current == Seam) {
GLGizmoSeam* seam = dynamic_cast<GLGizmoSeam*>(get_current());
if (seam != nullptr && keyCode == 'S' || keyCode == 'C') {
processed = seam->on_key_down_select_tool_type(keyCode);
}
if (processed) {
// force extra frame to automatically update window size
wxGetApp().imgui()->set_requires_extra_frame();
}
}
}
@ -1504,7 +1537,7 @@ void GLGizmosManager::update_on_off_state(const Vec2d& mouse_pos)
if (idx != Undefined && m_gizmos[idx]->is_activable() && m_hover == idx) {
activate_gizmo(m_current == idx ? Undefined : (EType)idx);
// BBS
wxGetApp().obj_list()->select_object_item((EType)idx <= Scale);
wxGetApp().obj_list()->select_object_item((EType) idx <= Scale || (EType) idx == Text);
}
}

View file

@ -304,7 +304,12 @@ void GizmoObjectManipulation::change_scale_value(int axis, double value)
return;
Vec3d scale = m_cache.scale;
scale(axis) = value;
if (scale[axis] != 0 && std::abs(m_cache.size[axis] * value / scale[axis]) > MAX_NUM) {
scale[axis] *= MAX_NUM / m_cache.size[axis];
}
else {
scale(axis) = value;
}
this->do_scale(axis, scale);
@ -351,7 +356,8 @@ void GizmoObjectManipulation::do_scale(int axis, const Vec3d &scale) const
transformation_type.set_local();
}
if (m_uniform_scale || selection.requires_uniform_scale())
// BBS: when select multiple objects, uniform scale can be deselected
if (m_uniform_scale/* || selection.requires_uniform_scale()*/)
scaling_factor = scale(axis) * Vec3d::Ones();
selection.start_dragging();
@ -505,18 +511,6 @@ bool GizmoObjectManipulation::reset_button(ImGuiWrapper *imgui_wrapper, float ca
unit_size = std::max(nuit_max[i], unit_size);
}
for (int i = 0; i < 3; i++)
{
if (str == "scale") {
if (vec1[i] > 39062.46)vec1[i] = 39062.46;
if (vec2[i] > 9999.99)vec2[i] = 9999.99;
}
if (str == "move") {
if (vec1[i] > 9999.99)vec1[i] = 9999.99;
if (vec2[i] > 9999.99)vec2[i] = 9999.99;
}
}
return unit_size + 8.0;
}
@ -609,6 +603,7 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper,
for (int i = 0;i<display_position.size();i++)
{
if (display_position[i] > MAX_NUM)display_position[i] = MAX_NUM;
if (display_position[i] < -MAX_NUM)display_position[i] = -MAX_NUM;
}
m_buffered_position = display_position;
@ -842,6 +837,7 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
ImGui::BBLInputDouble(label_scale_values[0][2], &scale[2], 0.0f, 0.0f, "%.2f");
ImGui::SameLine(caption_max + (++index_unit) *unit_size + (++index) * space_size);
imgui_wrapper->text(_L("%"));
m_buffered_scale = scale;
if (m_show_clear_scale) {
ImGui::SameLine(caption_max + 3 * unit_size + 4 * space_size + end_text_size);
@ -878,9 +874,8 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
for (int i = 0;i<display_size.size();i++)
{
if (display_size[i] > MAX_NUM || scale[i]> MAX_NUM)display_size[i] = MAX_NUM;
if (std::abs(display_size[i]) > MAX_NUM) display_size[i] = MAX_NUM;
}
m_buffered_scale = scale;
m_buffered_size = display_size;
int size_sel = update(current_active_id, "size", original_size, m_buffered_size);
ImGui::PopStyleVar(1);
@ -889,16 +884,18 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
bool uniform_scale = this->m_uniform_scale;
const Selection &selection = m_glcanvas.get_selection();
bool uniform_scale_only = selection.is_multiple_full_object() || selection.is_multiple_full_instance() || selection.is_mixed() || selection.is_multiple_volume() || selection.is_multiple_modifier();
// BBS: when select multiple objects, uniform scale can be deselected
//const Selection &selection = m_glcanvas.get_selection();
//bool uniform_scale_only = selection.is_multiple_full_object() || selection.is_multiple_full_instance() || selection.is_mixed() || selection.is_multiple_volume() ||
// selection.is_multiple_modifier();
if (uniform_scale_only) {
imgui_wrapper->disabled_begin(true);
imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale_only);
imgui_wrapper->disabled_end();
} else {
//if (uniform_scale_only) {
// imgui_wrapper->disabled_begin(true);
// imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale_only);
// imgui_wrapper->disabled_end();
//} else {
imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale);
}
//}
if (uniform_scale != this->m_uniform_scale) { this->set_uniform_scaling(uniform_scale); }
// for (int index = 0; index < 3; index++)