Merge remote-tracking branch 'origin/master' into ys_new_features
This commit is contained in:
commit
b5d7909afb
5 changed files with 173 additions and 32 deletions
120
.clang-format
Normal file
120
.clang-format
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
#
|
||||||
|
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||||
|
#
|
||||||
|
Language: Cpp
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: true
|
||||||
|
AlignConsecutiveDeclarations: true
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: true
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: false
|
||||||
|
BreakBeforeBinaryOperators: All
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 75
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- forever
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<Q.*'
|
||||||
|
Priority: 200
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepLineBreaksForNonEmptyLines: false
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 150
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 300
|
||||||
|
PenaltyBreakComment: 500
|
||||||
|
PenaltyBreakFirstLessLess: 400
|
||||||
|
PenaltyBreakString: 600
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 50
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 300
|
||||||
|
PointerAlignment: Right
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: false
|
||||||
|
SortUsingDeclarations: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
|
|
@ -44,6 +44,20 @@ GLGizmoSlaSupports::~GLGizmoSlaSupports()
|
||||||
bool GLGizmoSlaSupports::on_init()
|
bool GLGizmoSlaSupports::on_init()
|
||||||
{
|
{
|
||||||
m_shortcut_key = WXK_CONTROL_L;
|
m_shortcut_key = WXK_CONTROL_L;
|
||||||
|
|
||||||
|
m_desc["head_diameter"] = _(L("Head diameter")) + ": ";
|
||||||
|
m_desc["lock_supports"] = _(L("Lock supports under new islands"));
|
||||||
|
m_desc["remove_selected"] = _(L("Remove selected points"));
|
||||||
|
m_desc["remove_all"] = _(L("Remove all points"));
|
||||||
|
m_desc["apply_changes"] = _(L("Apply changes"));
|
||||||
|
m_desc["discard_changes"] = _(L("Discard changes"));
|
||||||
|
m_desc["minimal_distance"] = _(L("Minimal points distance")) + ": ";
|
||||||
|
m_desc["points_density"] = _(L("Support points density")) + ": ";
|
||||||
|
m_desc["auto_generate"] = _(L("Auto-generate points"));
|
||||||
|
m_desc["manual_editing"] = _(L("Manual editing"));
|
||||||
|
m_desc["clipping_of_view"] = _(L("Clipping of view"))+ ": ";
|
||||||
|
m_desc["reset_direction"] = _(L("Reset direction"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,7 +845,18 @@ RENDER_AGAIN:
|
||||||
m_imgui->set_next_window_bg_alpha(0.5f);
|
m_imgui->set_next_window_bg_alpha(0.5f);
|
||||||
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
||||||
|
|
||||||
//ImGui::PushItemWidth(m_imgui->scaled(5.55f));
|
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
||||||
|
|
||||||
|
const float settings_sliders_left = std::max(m_imgui->calc_text_size(m_desc.at("minimal_distance")).x, m_imgui->calc_text_size(m_desc.at("points_density")).x) + m_imgui->scaled(1.f);
|
||||||
|
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x, m_imgui->calc_text_size(m_desc.at("reset_direction")).x) + m_imgui->scaled(1.5f);
|
||||||
|
const float diameter_slider_left = m_imgui->calc_text_size(m_desc.at("head_diameter")).x + m_imgui->scaled(1.f);
|
||||||
|
const float minimal_slider_width = m_imgui->scaled(4.f);
|
||||||
|
const float buttons_width_approx = m_imgui->calc_text_size(m_desc.at("apply_changes")).x + m_imgui->calc_text_size(m_desc.at("discard_changes")).x + m_imgui->scaled(1.5f);
|
||||||
|
const float lock_supports_width_approx = m_imgui->calc_text_size(m_desc.at("lock_supports")).x + m_imgui->scaled(2.f);
|
||||||
|
|
||||||
|
float window_width = minimal_slider_width + std::max(std::max(settings_sliders_left, clipping_slider_left), diameter_slider_left);
|
||||||
|
window_width = std::max(std::max(window_width, buttons_width_approx), lock_supports_width_approx);
|
||||||
|
|
||||||
|
|
||||||
bool force_refresh = false;
|
bool force_refresh = false;
|
||||||
bool remove_selected = false;
|
bool remove_selected = false;
|
||||||
|
@ -842,12 +867,9 @@ RENDER_AGAIN:
|
||||||
float diameter_upper_cap = static_cast<ConfigOptionFloat*>(wxGetApp().preset_bundle->sla_prints.get_edited_preset().config.option("support_pillar_diameter"))->value;
|
float diameter_upper_cap = static_cast<ConfigOptionFloat*>(wxGetApp().preset_bundle->sla_prints.get_edited_preset().config.option("support_pillar_diameter"))->value;
|
||||||
if (m_new_point_head_diameter > diameter_upper_cap)
|
if (m_new_point_head_diameter > diameter_upper_cap)
|
||||||
m_new_point_head_diameter = diameter_upper_cap;
|
m_new_point_head_diameter = diameter_upper_cap;
|
||||||
|
m_imgui->text(m_desc.at("head_diameter"));
|
||||||
wxString text = _(L("Head diameter")) + ": ";
|
ImGui::SameLine(diameter_slider_left);
|
||||||
m_imgui->text(text);
|
ImGui::PushItemWidth(window_width - diameter_slider_left);
|
||||||
float slider_left = m_imgui->calc_text_size(text).x + m_imgui->scaled(1.f);
|
|
||||||
ImGui::SameLine(/*m_imgui->scaled(6.66f)*/slider_left);
|
|
||||||
ImGui::PushItemWidth(/*m_imgui->scaled(8.33f)*/m_imgui->scaled(15.f) - slider_left);
|
|
||||||
|
|
||||||
if (ImGui::SliderFloat("", &m_new_point_head_diameter, 0.1f, diameter_upper_cap, "%.1f")) {
|
if (ImGui::SliderFloat("", &m_new_point_head_diameter, 0.1f, diameter_upper_cap, "%.1f")) {
|
||||||
// value was changed
|
// value was changed
|
||||||
|
@ -859,37 +881,34 @@ RENDER_AGAIN:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = m_lock_unique_islands;
|
bool changed = m_lock_unique_islands;
|
||||||
m_imgui->checkbox(_(L("Lock supports under new islands")), m_lock_unique_islands);
|
m_imgui->checkbox(m_desc.at("lock_supports"), m_lock_unique_islands);
|
||||||
force_refresh |= changed != m_lock_unique_islands;
|
force_refresh |= changed != m_lock_unique_islands;
|
||||||
|
|
||||||
m_imgui->disabled_begin(m_selection_empty);
|
m_imgui->disabled_begin(m_selection_empty);
|
||||||
remove_selected = m_imgui->button(_(L("Remove selected points")));
|
remove_selected = m_imgui->button(m_desc.at("remove_selected"));
|
||||||
m_imgui->disabled_end();
|
m_imgui->disabled_end();
|
||||||
|
|
||||||
m_imgui->disabled_begin(m_editing_mode_cache.empty());
|
m_imgui->disabled_begin(m_editing_mode_cache.empty());
|
||||||
remove_all = m_imgui->button(_(L("Remove all points")));
|
remove_all = m_imgui->button(m_desc.at("remove_all"));
|
||||||
m_imgui->disabled_end();
|
m_imgui->disabled_end();
|
||||||
|
|
||||||
m_imgui->text(" "); // vertical gap
|
m_imgui->text(" "); // vertical gap
|
||||||
|
|
||||||
if (m_imgui->button(_(L("Apply changes")))) {
|
if (m_imgui->button(m_desc.at("apply_changes"))) {
|
||||||
editing_mode_apply_changes();
|
editing_mode_apply_changes();
|
||||||
force_refresh = true;
|
force_refresh = true;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool discard_changes = m_imgui->button(_(L("Discard changes")));
|
bool discard_changes = m_imgui->button(m_desc.at("discard_changes"));
|
||||||
if (discard_changes) {
|
if (discard_changes) {
|
||||||
editing_mode_discard_changes();
|
editing_mode_discard_changes();
|
||||||
force_refresh = true;
|
force_refresh = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // not in editing mode:
|
else { // not in editing mode:
|
||||||
wxString text1 = _(L("Minimal points distance")) + ": ";
|
m_imgui->text(m_desc.at("minimal_distance"));
|
||||||
wxString text2 = _(L("Support points density")) + ": ";
|
ImGui::SameLine(settings_sliders_left);
|
||||||
float sliders_left = std::max(m_imgui->calc_text_size(text1).x, m_imgui->calc_text_size(text2).x) + m_imgui->scaled(1.f);
|
ImGui::PushItemWidth(window_width - settings_sliders_left);
|
||||||
m_imgui->text(text1);
|
|
||||||
ImGui::SameLine(/*m_imgui->scaled(9.44f)*/sliders_left);
|
|
||||||
ImGui::PushItemWidth(/*m_imgui->scaled(5.55f)*/m_imgui->scaled(15.f)-sliders_left);
|
|
||||||
|
|
||||||
std::vector<const ConfigOption*> opts = get_config_options({"support_points_density_relative", "support_points_minimal_distance"});
|
std::vector<const ConfigOption*> opts = get_config_options({"support_points_density_relative", "support_points_minimal_distance"});
|
||||||
float density = static_cast<const ConfigOptionInt*>(opts[0])->value;
|
float density = static_cast<const ConfigOptionInt*>(opts[0])->value;
|
||||||
|
@ -899,8 +918,8 @@ RENDER_AGAIN:
|
||||||
if (value_changed)
|
if (value_changed)
|
||||||
m_model_object->config.opt<ConfigOptionFloat>("support_points_minimal_distance", true)->value = minimal_point_distance;
|
m_model_object->config.opt<ConfigOptionFloat>("support_points_minimal_distance", true)->value = minimal_point_distance;
|
||||||
|
|
||||||
m_imgui->text(text2);
|
m_imgui->text(m_desc.at("points_density"));
|
||||||
ImGui::SameLine(/*m_imgui->scaled(9.44f)*/sliders_left);
|
ImGui::SameLine(settings_sliders_left);
|
||||||
|
|
||||||
if (ImGui::SliderFloat(" ", &density, 0.f, 200.f, "%.f %%")) {
|
if (ImGui::SliderFloat(" ", &density, 0.f, 200.f, "%.f %%")) {
|
||||||
value_changed = true;
|
value_changed = true;
|
||||||
|
@ -914,17 +933,17 @@ RENDER_AGAIN:
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool generate = m_imgui->button(_(L("Auto-generate points")));
|
bool generate = m_imgui->button(m_desc.at("auto_generate"));
|
||||||
|
|
||||||
if (generate)
|
if (generate)
|
||||||
auto_generate();
|
auto_generate();
|
||||||
|
|
||||||
m_imgui->text("");
|
m_imgui->text("");
|
||||||
if (m_imgui->button(_(L("Manual editing"))))
|
if (m_imgui->button(m_desc.at("manual_editing")))
|
||||||
switch_to_editing_mode();
|
switch_to_editing_mode();
|
||||||
|
|
||||||
m_imgui->disabled_begin(m_editing_mode_cache.empty());
|
m_imgui->disabled_begin(m_editing_mode_cache.empty());
|
||||||
remove_all = m_imgui->button(_(L("Remove all points")));
|
remove_all = m_imgui->button(m_desc.at("remove_all"));
|
||||||
m_imgui->disabled_end();
|
m_imgui->disabled_end();
|
||||||
|
|
||||||
// m_imgui->text("");
|
// m_imgui->text("");
|
||||||
|
@ -937,21 +956,18 @@ RENDER_AGAIN:
|
||||||
|
|
||||||
// Following is rendered in both editing and non-editing mode:
|
// Following is rendered in both editing and non-editing mode:
|
||||||
m_imgui->text("");
|
m_imgui->text("");
|
||||||
wxString text1 = _(L("Clipping of view"))+ ": ";
|
|
||||||
wxString text2 = _(L("Reset direction"));
|
|
||||||
float slider_left = std::max(m_imgui->calc_text_size(text1).x, m_imgui->calc_text_size(text2).x) + m_imgui->scaled(1.5f);
|
|
||||||
if (m_clipping_plane_distance == 0.f)
|
if (m_clipping_plane_distance == 0.f)
|
||||||
m_imgui->text(text1);
|
m_imgui->text(m_desc.at("clipping_of_view"));
|
||||||
else {
|
else {
|
||||||
if (m_imgui->button(text2)) {
|
if (m_imgui->button(m_desc.at("reset_direction"))) {
|
||||||
wxGetApp().CallAfter([this](){
|
wxGetApp().CallAfter([this](){
|
||||||
reset_clipping_plane_normal();
|
reset_clipping_plane_normal();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine(/*m_imgui->scaled(6.66f)*/slider_left);
|
ImGui::SameLine(clipping_slider_left);
|
||||||
ImGui::PushItemWidth(/*m_imgui->scaled(8.33f)*/m_imgui->scaled(15.f) - slider_left);
|
ImGui::PushItemWidth(window_width - clipping_slider_left);
|
||||||
ImGui::SliderFloat(" ", &m_clipping_plane_distance, 0.f, 1.f, "%.2f");
|
ImGui::SliderFloat(" ", &m_clipping_plane_distance, 0.f, 1.f, "%.2f");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,10 @@ private:
|
||||||
mutable Vec3d m_old_clipping_plane_normal;
|
mutable Vec3d m_old_clipping_plane_normal;
|
||||||
mutable Vec3d m_clipping_plane_normal = Vec3d::Zero();
|
mutable Vec3d m_clipping_plane_normal = Vec3d::Zero();
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
GLSelectionRectangle m_selection_rectangle;
|
GLSelectionRectangle m_selection_rectangle;
|
||||||
|
|
||||||
bool m_wait_for_up_event = false;
|
bool m_wait_for_up_event = false;
|
||||||
|
|
|
@ -225,10 +225,10 @@ ImVec2 ImGuiWrapper::calc_text_size(const wxString &text)
|
||||||
auto text_utf8 = into_u8(text);
|
auto text_utf8 = into_u8(text);
|
||||||
ImVec2 size = ImGui::CalcTextSize(text_utf8.c_str());
|
ImVec2 size = ImGui::CalcTextSize(text_utf8.c_str());
|
||||||
|
|
||||||
#ifndef __APPLE__
|
/*#ifdef __linux__
|
||||||
size.x *= m_style_scaling;
|
size.x *= m_style_scaling;
|
||||||
size.y *= m_style_scaling;
|
size.y *= m_style_scaling;
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ void KBShortcutsDialog::fill_shortcuts()
|
||||||
plater_shortcuts.push_back(Shortcut("F", L("Gizmo Place face on bed")));
|
plater_shortcuts.push_back(Shortcut("F", L("Gizmo Place face on bed")));
|
||||||
plater_shortcuts.push_back(Shortcut("L", L("Gizmo SLA support points")));
|
plater_shortcuts.push_back(Shortcut("L", L("Gizmo SLA support points")));
|
||||||
plater_shortcuts.push_back(Shortcut("Shift+", L("Press to activate selection rectangle\nor to snap by 5% in Gizmo scale\nor to snap by 1mm in Gizmo move")));
|
plater_shortcuts.push_back(Shortcut("Shift+", L("Press to activate selection rectangle\nor to snap by 5% in Gizmo scale\nor to snap by 1mm in Gizmo move")));
|
||||||
|
plater_shortcuts.push_back(Shortcut("F", L("Press to scale selection to fit print volume\nin Gizmo scale")));
|
||||||
plater_shortcuts.push_back(Shortcut(alt, L("Press to activate deselection rectangle\nor to scale or rotate selected objects\naround their own center")));
|
plater_shortcuts.push_back(Shortcut(alt, L("Press to activate deselection rectangle\nor to scale or rotate selected objects\naround their own center")));
|
||||||
plater_shortcuts.push_back(Shortcut(ctrl, L("Press to activate one direction scaling in Gizmo scale")));
|
plater_shortcuts.push_back(Shortcut(ctrl, L("Press to activate one direction scaling in Gizmo scale")));
|
||||||
plater_shortcuts.push_back(Shortcut("B", L("Zoom to Bed")));
|
plater_shortcuts.push_back(Shortcut("B", L("Zoom to Bed")));
|
||||||
|
|
Loading…
Reference in a new issue