mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-23 10:33:14 +08:00
NEW:Color painting shortcut keys 10~16
JIRA:STUDIO-6238 Change-Id: I3cce838fad5e73d41f109b32f2e563716fd5b0da
This commit is contained in:
parent
96e29c7b70
commit
0dcdf96d85
@ -250,7 +250,7 @@ void GLGizmoMmuSegmentation::render_triangles(const Selection &selection) const
|
||||
bool GLGizmoMmuSegmentation::on_number_key_down(int number)
|
||||
{
|
||||
int extruder_idx = number - 1;
|
||||
if (extruder_idx < m_extruders_colors.size())
|
||||
if (extruder_idx < m_extruders_colors.size() && extruder_idx >= 0)
|
||||
m_selected_extruder_idx = extruder_idx;
|
||||
|
||||
return true;
|
||||
@ -523,7 +523,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||
color_button_high = ImGui::GetCursorPos().y - color_button - 2.0;
|
||||
if (color_picked) { m_selected_extruder_idx = extruder_idx; }
|
||||
|
||||
if (extruder_idx < 9 && ImGui::IsItemHovered()) m_imgui->tooltip(_L("Shortcut Key ") + std::to_string(extruder_idx + 1), max_tooltip_width);
|
||||
if (extruder_idx < 16 && ImGui::IsItemHovered()) m_imgui->tooltip(_L("Shortcut Key ") + std::to_string(extruder_idx + 1), max_tooltip_width);
|
||||
|
||||
// draw filament id
|
||||
float gray = 0.299 * extruder_color[0] + 0.587 * extruder_color[1] + 0.114 * extruder_color[2];
|
||||
|
@ -50,6 +50,7 @@ GLGizmosManager::GLGizmosManager(GLCanvas3D& parent)
|
||||
//BBS: GUI refactor: add object manipulation in gizmo
|
||||
, m_object_manipulation(parent)
|
||||
{
|
||||
m_timer_set_color.Bind(wxEVT_TIMER, &GLGizmosManager::on_set_color_timer, this);
|
||||
}
|
||||
|
||||
std::vector<size_t> GLGizmosManager::get_selectable_idxs() const
|
||||
@ -1250,9 +1251,19 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
||||
else if (m_current == MmuSegmentation) {
|
||||
GLGizmoMmuSegmentation* mmu_seg = dynamic_cast<GLGizmoMmuSegmentation*>(get_current());
|
||||
if (mmu_seg != nullptr) {
|
||||
if (keyCode > '0' && keyCode <= '9') {
|
||||
if (keyCode >= '0' && keyCode <= '9') {
|
||||
if (keyCode == '1' && !m_timer_set_color.IsRunning()) {
|
||||
m_timer_set_color.StartOnce(500);
|
||||
processed = true;
|
||||
}
|
||||
else if (keyCode < '7' && m_timer_set_color.IsRunning()) {
|
||||
processed = mmu_seg->on_number_key_down(keyCode - '0'+10);
|
||||
m_timer_set_color.Stop();
|
||||
}
|
||||
else {
|
||||
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) {
|
||||
@ -1290,6 +1301,15 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
||||
return processed;
|
||||
}
|
||||
|
||||
void GLGizmosManager::on_set_color_timer(wxTimerEvent& evt)
|
||||
{
|
||||
if (m_current == MmuSegmentation) {
|
||||
GLGizmoMmuSegmentation* mmu_seg = dynamic_cast<GLGizmoMmuSegmentation*>(get_current());
|
||||
mmu_seg->on_number_key_down(1);
|
||||
m_parent.set_as_dirty();
|
||||
}
|
||||
}
|
||||
|
||||
void GLGizmosManager::update_after_undo_redo(const UndoRedo::Snapshot& snapshot)
|
||||
{
|
||||
update_data();
|
||||
|
@ -143,6 +143,10 @@ private:
|
||||
bool m_serializing;
|
||||
std::unique_ptr<CommonGizmosDataPool> m_common_gizmos_data;
|
||||
|
||||
//When there are more than 9 colors, shortcut key coloring
|
||||
wxTimer m_timer_set_color;
|
||||
void on_set_color_timer(wxTimerEvent& evt);
|
||||
|
||||
// key MENU_ICON_NAME, value = ImtextureID
|
||||
std::map<int, void*> icon_list;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user