This commit is contained in:
bubnikv 2019-06-25 08:57:03 +02:00
commit 27cc66eb54
8 changed files with 30 additions and 16 deletions

View File

@ -73,8 +73,8 @@ void AppConfig::set_defaults()
if (get("custom_toolbar_size").empty())
set("custom_toolbar_size", "100");
if (get("camera_type").empty())
set("camera_type", "1");
if (get("use_perspective_camera").empty())
set("use_perspective_camera", "1");
// Remove legacy window positions/sizes
erase("", "main_frame_maximized");

View File

@ -31,7 +31,7 @@ Camera::Camera()
: phi(45.0f)
, requires_zoom_to_bed(false)
, inverted_phi(false)
, m_type(Ortho)
, m_type(Perspective)
, m_target(Vec3d::Zero())
, m_theta(45.0f)
, m_zoom(1.0)
@ -61,20 +61,17 @@ void Camera::set_type(EType type)
if (m_type != type)
{
m_type = type;
wxGetApp().app_config->set("camera_type", std::to_string(m_type));
wxGetApp().app_config->set("use_perspective_camera", (m_type == Perspective) ? "1" : "0");
wxGetApp().app_config->save();
}
}
void Camera::set_type(const std::string& type)
{
if (!type.empty() && (type != "1"))
{
unsigned char type_id = atoi(type.c_str());
if (((unsigned char)Ortho < type_id) && (type_id < (unsigned char)Num_types))
set_type((Camera::EType)type_id);
}
if (type == "1")
set_type(Perspective);
else
set_type(Ortho);
}
void Camera::select_next_type()

View File

@ -49,6 +49,7 @@ public:
EType get_type() const { return m_type; }
std::string get_type_as_string() const;
void set_type(EType type);
// valid values for type: "0" -> ortho, "1" -> perspective
void set_type(const std::string& type);
void select_next_type();

View File

@ -3312,6 +3312,9 @@ void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool foc
void GLCanvas3D::update_ui_from_settings()
{
m_camera.set_type(wxGetApp().app_config->get("use_perspective_camera"));
m_dirty = true;
#if ENABLE_RETINA_GL
const float orig_scaling = m_retina_helper->get_scale_factor();

View File

@ -313,6 +313,12 @@ Preview::~Preview()
}
}
void Preview::set_as_dirty()
{
if (m_canvas != nullptr)
m_canvas->set_as_dirty();
}
void Preview::set_number_extruders(unsigned int number_extruders)
{
if (m_number_extruders != number_extruders)

View File

@ -110,6 +110,8 @@ public:
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
GLCanvas3D* get_canvas3d() { return m_canvas; }
void set_as_dirty();
void set_number_extruders(unsigned int number_extruders);
void set_canvas_as_dirty();
void set_enabled(bool enabled);

View File

@ -1774,7 +1774,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
set_current_panel(view3D);
// updates camera type from .ini file
camera.set_type(get_config("camera_type"));
camera.set_type(get_config("use_perspective_camera"));
}
void Plater::priv::update(bool force_full_scene_refresh)
@ -1842,10 +1842,8 @@ void Plater::priv::update_ui_from_settings()
// $self->{buttons_sizer}->Layout;
// }
#if ENABLE_RETINA_GL
view3D->get_canvas3d()->update_ui_from_settings();
preview->get_canvas3d()->update_ui_from_settings();
#endif
}
ProgressStatusBar* Plater::priv::statusbar()

View File

@ -28,7 +28,7 @@ void PreferencesDialog::build()
m_icon_size_sizer->ShowItems(boost::any_cast<bool>(value));
this->layout();
}
};
};
// TODO
// $optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
@ -97,7 +97,7 @@ void PreferencesDialog::build()
option = Option (def,"show_incompatible_presets");
m_optgroup->append_single_option_line(option);
// TODO: remove?
// TODO: remove?
def.label = L("Use legacy OpenGL 1.1 rendering");
def.type = coBool;
def.tooltip = L("If you have rendering issues caused by a buggy OpenGL 2.0 driver, "
@ -117,6 +117,13 @@ void PreferencesDialog::build()
m_optgroup->append_single_option_line(option);
#endif
def.label = L("Use perspective camera");
def.type = coBool;
def.tooltip = L("If enabled, use perspective camera. If not enabled, use orthographic camera.");
def.set_default_value(new ConfigOptionBool{ app_config->get("use_perspective_camera") == "1" });
option = Option(def, "use_perspective_camera");
m_optgroup->append_single_option_line(option);
def.label = L("Use custom size for toolbar icons");
def.type = coBool;
def.tooltip = L("If enabled, you can change size of toolbar icons manually.");