mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 05:54:03 -06:00
Feature/move plate to the front (#6262)
* WIP:only works after saving and then reloading * working version of move plate to the front * added icons for move to front * removed a commented line * fixed the move to front function to behave correctly with undo/redo actions * Merge branch 'main' into feature/move_plate_to_the_front
This commit is contained in:
parent
473c7fb3ef
commit
8d9ec11fe9
7 changed files with 349 additions and 1 deletions
|
@ -1035,6 +1035,13 @@ void PartPlate::render_icons(bool bottom, bool only_name, int hover_id)
|
|||
else
|
||||
render_icon_texture(m_plate_name_edit_icon.model, m_partplate_list->m_plate_name_edit_texture);
|
||||
|
||||
if (hover_id == 7) {
|
||||
render_icon_texture(m_move_front_icon.model, m_partplate_list->m_move_front_hovered_texture);
|
||||
show_tooltip("Move plate to the front");
|
||||
} else
|
||||
render_icon_texture(m_move_front_icon.model, m_partplate_list->m_move_front_texture);
|
||||
|
||||
|
||||
if (m_partplate_list->render_plate_settings) {
|
||||
bool has_plate_settings = get_bed_type() != BedType::btDefault || get_print_seq() != PrintSequence::ByDefault || !get_first_layer_print_sequence().empty() || !get_other_layers_print_sequence().empty() || has_spiral_mode_config();
|
||||
if (hover_id == 5) {
|
||||
|
@ -1336,6 +1343,7 @@ void PartPlate::register_raycasters_for_picking(GLCanvas3D &canvas)
|
|||
|
||||
canvas.remove_raycasters_for_picking(SceneRaycaster::EType::Bed, picking_id_component(6));
|
||||
register_model_for_picking(canvas, m_plate_name_edit_icon, picking_id_component(6));
|
||||
register_model_for_picking(canvas, m_move_front_icon, picking_id_component(7));
|
||||
}
|
||||
|
||||
int PartPlate::picking_id_component(int idx) const
|
||||
|
@ -2712,6 +2720,7 @@ bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Ve
|
|||
calc_vertex_for_icons(2, m_arrange_icon);
|
||||
calc_vertex_for_icons(3, m_lock_icon);
|
||||
calc_vertex_for_icons(4, m_plate_settings_icon);
|
||||
calc_vertex_for_icons(5, m_move_front_icon);
|
||||
//calc_vertex_for_number(0, (m_plate_index < 9), m_plate_idx_icon);
|
||||
calc_vertex_for_number(0, false, m_plate_idx_icon);
|
||||
if (m_plater) {
|
||||
|
@ -3284,6 +3293,23 @@ void PartPlateList::generate_icon_textures()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// if (m_move_front_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_move_front_dark.svg" : "plate_move_front.svg");
|
||||
if (!m_move_front_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
// if (m_move_front_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_move_front_hover_dark.svg" : "plate_move_front_hover.svg");
|
||||
if (!m_move_front_hovered_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
//if (m_arrange_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_arrange_dark.svg" : "plate_arrange.svg");
|
||||
|
@ -3419,6 +3445,8 @@ void PartPlateList::release_icon_textures()
|
|||
m_logo_texture.reset();
|
||||
m_del_texture.reset();
|
||||
m_del_hovered_texture.reset();
|
||||
m_move_front_hovered_texture.reset();
|
||||
m_move_front_texture.reset();
|
||||
m_arrange_texture.reset();
|
||||
m_arrange_hovered_texture.reset();
|
||||
m_orient_texture.reset();
|
||||
|
@ -3580,6 +3608,13 @@ void PartPlateList::reinit()
|
|||
/*basic plate operations*/
|
||||
//create an empty plate, and return its index
|
||||
//these model instances which are not in any plates should not be affected also
|
||||
|
||||
void PartPlateList::update_plates()
|
||||
{
|
||||
update_all_plates_pos_and_size(true, false);
|
||||
set_shapes(m_shape, m_exclude_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod);
|
||||
}
|
||||
|
||||
int PartPlateList::create_plate(bool adjust_position)
|
||||
{
|
||||
PartPlate* plate = NULL;
|
||||
|
|
|
@ -141,6 +141,7 @@ private:
|
|||
PickingModel m_lock_icon;
|
||||
PickingModel m_plate_settings_icon;
|
||||
PickingModel m_plate_name_edit_icon;
|
||||
PickingModel m_move_front_icon;
|
||||
GLModel m_plate_idx_icon;
|
||||
GLTexture m_texture;
|
||||
|
||||
|
@ -199,7 +200,7 @@ private:
|
|||
public:
|
||||
static const unsigned int PLATE_BASE_ID = 255 * 255 * 253;
|
||||
static const unsigned int PLATE_NAME_HOVER_ID = 6;
|
||||
static const unsigned int GRABBER_COUNT = 7;
|
||||
static const unsigned int GRABBER_COUNT = 8;
|
||||
|
||||
static ColorRGBA SELECT_COLOR;
|
||||
static ColorRGBA UNSELECT_COLOR;
|
||||
|
@ -546,6 +547,8 @@ class PartPlateList : public ObjectBase
|
|||
GLTexture m_logo_texture;
|
||||
GLTexture m_del_texture;
|
||||
GLTexture m_del_hovered_texture;
|
||||
GLTexture m_move_front_hovered_texture;
|
||||
GLTexture m_move_front_texture;
|
||||
GLTexture m_arrange_texture;
|
||||
GLTexture m_arrange_hovered_texture;
|
||||
GLTexture m_orient_texture;
|
||||
|
@ -656,6 +659,9 @@ public:
|
|||
height = m_plate_height;
|
||||
}
|
||||
|
||||
// Pantheon: update plates after moving plate to the front
|
||||
void update_plates();
|
||||
|
||||
/*basic plate operations*/
|
||||
//create an empty plate and return its index
|
||||
int create_plate(bool adjust_position = true);
|
||||
|
|
|
@ -14001,7 +14001,18 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
|
|||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "can not select plate %1%" << plate_index;
|
||||
ret = -1;
|
||||
}
|
||||
} else if ((action == 7) && (!right_click)) {
|
||||
// move plate to the front
|
||||
take_snapshot("move plate to the front");
|
||||
ret = p->partplate_list.move_plate_to_index(plate_index,0);
|
||||
p->partplate_list.update_slice_context_to_current_plate(p->background_process);
|
||||
p->preview->update_gcode_result(p->partplate_list.get_current_slice_result());
|
||||
p->sidebar->obj_list()->reload_all_plates();
|
||||
p->partplate_list.update_plates();
|
||||
update();
|
||||
p->partplate_list.select_plate(0);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "invalid action %1%, with right_click=%2%" << action << right_click;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue