NEW:add measure gizmo in assemble view
Jira: STUDIO-6545 Change-Id: I83b85f26305754c99088abb81fe568619151d32f
This commit is contained in:
parent
9c10410f19
commit
fa53be3736
|
@ -1275,6 +1275,7 @@ public:
|
|||
m_assemble_initialized = true;
|
||||
m_assemble_transformation.set_from_transform(transform);
|
||||
}
|
||||
const Vec3d& get_assemble_offset() {return m_assemble_transformation.get_offset(); }
|
||||
void set_assemble_offset(const Vec3d& offset) { m_assemble_transformation.set_offset(offset); }
|
||||
void set_assemble_rotation(const Vec3d &rotation) { m_assemble_transformation.set_rotation(rotation); }
|
||||
void rotate_assemble(double angle, const Vec3d& axis) {
|
||||
|
|
|
@ -4574,7 +4574,9 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
|
|||
if (model_object != nullptr) {
|
||||
if (selection_mode == Selection::Instance) {
|
||||
if (m_canvas_type == GLCanvas3D::ECanvasType::CanvasAssembleView) {
|
||||
model_object->instances[instance_idx]->set_assemble_offset(v->get_instance_offset());
|
||||
if ((model_object->instances[instance_idx]->get_assemble_offset() - v->get_instance_offset()).norm() > 1e-2) {
|
||||
model_object->instances[instance_idx]->set_assemble_offset(v->get_instance_offset());
|
||||
}
|
||||
} else {
|
||||
model_object->instances[instance_idx]->set_offset(v->get_instance_offset());
|
||||
}
|
||||
|
|
|
@ -711,6 +711,7 @@ public:
|
|||
bool init();
|
||||
void post_event(wxEvent &&event);
|
||||
|
||||
float get_explosion_ratio() { return m_explosion_ratio; }
|
||||
void reset_explosion_ratio() { m_explosion_ratio = 1.0; }
|
||||
void on_change_color_mode(bool is_dark, bool reinit = true);
|
||||
const bool get_dark_mode_status() { return m_is_dark; }
|
||||
|
|
|
@ -811,7 +811,7 @@ bool AssembleView::init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrint
|
|||
m_canvas->enable_assemble_view_toolbar(false);
|
||||
m_canvas->enable_return_toolbar(true);
|
||||
m_canvas->enable_separator_toolbar(false);
|
||||
m_canvas->set_show_world_axes(true);
|
||||
//m_canvas->set_show_world_axes(true);//wait for GitHub users to see if they have this requirement
|
||||
// BBS: set volume_selection_mode to Volume
|
||||
//same to 3d //m_canvas->get_selection().set_volume_selection_mode(Selection::Instance);
|
||||
//m_canvas->get_selection().lock_volume_selection_mode();
|
||||
|
|
|
@ -575,7 +575,12 @@ void GLGizmoMeasure::on_set_state()
|
|||
std::string GLGizmoMeasure::on_get_name() const
|
||||
{
|
||||
if (!on_is_activable() && m_state == EState::Off) {
|
||||
return _u8L("Measure") + ":\n" + _u8L("Please select at least one object.");
|
||||
if (wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) {
|
||||
return _u8L("Measure") + ":\n" + _u8L("Please confirm explosion ratio = 1,and please select at least one object");
|
||||
}
|
||||
else {
|
||||
return _u8L("Measure") + ":\n" + _u8L("Please select at least one object.");
|
||||
}
|
||||
} else {
|
||||
return _u8L("Measure");
|
||||
}
|
||||
|
@ -584,7 +589,14 @@ std::string GLGizmoMeasure::on_get_name() const
|
|||
bool GLGizmoMeasure::on_is_activable() const
|
||||
{
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
return selection.volumes_count()>0;
|
||||
if (wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) {
|
||||
if (abs(m_parent.get_explosion_ratio() - 1.0f) < 1e-2 && selection.volumes_count() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return selection.volumes_count() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GLGizmoMeasure::init_circle_glmodel(GripperType gripper_type, const Measure::SurfaceFeature &feature, CircleGLModel &circle_gl_model,float inv_zoom)
|
||||
|
|
|
@ -61,6 +61,7 @@ std::vector<size_t> GLGizmosManager::get_selectable_idxs() const
|
|||
for (size_t i = 0; i < m_gizmos.size(); ++i)
|
||||
if (m_gizmos[i]->get_sprite_id() == (unsigned int) Move ||
|
||||
m_gizmos[i]->get_sprite_id() == (unsigned int) Rotate ||
|
||||
m_gizmos[i]->get_sprite_id() == (unsigned int) Measure ||
|
||||
m_gizmos[i]->get_sprite_id() == (unsigned int) MmuSegmentation)
|
||||
out.push_back(i);
|
||||
}
|
||||
|
|
|
@ -2943,6 +2943,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
//BBS
|
||||
wxGLCanvas* assemble_canvas = assemble_view->get_wxglcanvas();
|
||||
if (wxGetApp().is_editor()) {
|
||||
assemble_canvas->Bind(EVT_GLCANVAS_INSTANCE_MOVED, [this](SimpleEvent &) { update(); });
|
||||
assemble_canvas->Bind(EVT_GLCANVAS_INSTANCE_ROTATED, [this](SimpleEvent &) { update(); });
|
||||
|
||||
assemble_canvas->Bind(EVT_GLTOOLBAR_FILLCOLOR, [q](IntEvent& evt) { q->fill_color(evt.get_data()); });
|
||||
assemble_canvas->Bind(EVT_GLCANVAS_OBJECT_SELECT, &priv::on_object_select, this);
|
||||
assemble_canvas->Bind(EVT_GLVIEWTOOLBAR_3D, [q](SimpleEvent&) { q->select_view_3D("3D"); });
|
||||
|
|
|
@ -2866,6 +2866,9 @@ void Selection::ensure_not_below_bed()
|
|||
|
||||
bool Selection::is_from_fully_selected_instance(unsigned int volume_idx) const
|
||||
{
|
||||
if (m_mode == Instance && wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) {
|
||||
return true;
|
||||
}
|
||||
struct SameInstance
|
||||
{
|
||||
int obj_idx;
|
||||
|
|
Loading…
Reference in New Issue