mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Started porting of the functions for object settings editing
This commit is contained in:
parent
1c695fd97e
commit
8899be8cca
5 changed files with 93 additions and 0 deletions
|
@ -192,6 +192,8 @@ add_library(libslic3r_gui STATIC
|
||||||
${LIBDIR}/slic3r/GUI/PresetHints.hpp
|
${LIBDIR}/slic3r/GUI/PresetHints.hpp
|
||||||
${LIBDIR}/slic3r/GUI/GUI.cpp
|
${LIBDIR}/slic3r/GUI/GUI.cpp
|
||||||
${LIBDIR}/slic3r/GUI/GUI.hpp
|
${LIBDIR}/slic3r/GUI/GUI.hpp
|
||||||
|
${LIBDIR}/slic3r/GUI/GUI_ObjectParts.cpp
|
||||||
|
${LIBDIR}/slic3r/GUI/GUI_ObjectParts.hpp
|
||||||
${LIBDIR}/slic3r/GUI/Tab.cpp
|
${LIBDIR}/slic3r/GUI/Tab.cpp
|
||||||
${LIBDIR}/slic3r/GUI/Tab.hpp
|
${LIBDIR}/slic3r/GUI/Tab.hpp
|
||||||
${LIBDIR}/slic3r/GUI/TabIface.cpp
|
${LIBDIR}/slic3r/GUI/TabIface.cpp
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "PresetBundle.hpp"
|
#include "PresetBundle.hpp"
|
||||||
#include "UpdateDialogs.hpp"
|
#include "UpdateDialogs.hpp"
|
||||||
#include "FirmwareDialog.hpp"
|
#include "FirmwareDialog.hpp"
|
||||||
|
#include "GUI_ObjectParts.hpp"
|
||||||
|
|
||||||
#include "../Utils/PresetUpdater.hpp"
|
#include "../Utils/PresetUpdater.hpp"
|
||||||
#include "../Config/Snapshot.hpp"
|
#include "../Config/Snapshot.hpp"
|
||||||
|
@ -495,6 +496,27 @@ void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_languag
|
||||||
add_config_menu(menu, event_preferences_changed, event_language_change);
|
add_config_menu(menu, event_preferences_changed, event_language_change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxArrayString* open_model(wxWindow *parent){
|
||||||
|
t_file_wild_card vec_FILE_WILDCARDS = get_file_wild_card();
|
||||||
|
std::vector<std::string> file_types = { "known", "stl", "obj", "amf", "3mf", "prusa" };
|
||||||
|
wxString MODEL_WILDCARD;
|
||||||
|
for (auto file_type : file_types)
|
||||||
|
MODEL_WILDCARD += vec_FILE_WILDCARDS.at(file_type) + "|";
|
||||||
|
|
||||||
|
auto dlg_title = _(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):"));
|
||||||
|
auto dialog = new wxFileDialog(parent /*? parent : GetTopWindow(g_wxMainFrame)*/, dlg_title,
|
||||||
|
g_AppConfig->get_last_dir(), "",
|
||||||
|
MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST);
|
||||||
|
if (dialog->ShowModal() != wxID_OK) {
|
||||||
|
dialog->Destroy();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
wxArrayString input_files;
|
||||||
|
dialog->GetPaths(input_files);
|
||||||
|
dialog->Destroy();
|
||||||
|
return &input_files;
|
||||||
|
}
|
||||||
|
|
||||||
// This is called when closing the application, when loading a config file or when starting the config wizard
|
// This is called when closing the application, when loading a config file or when starting the config wizard
|
||||||
// to notify the user whether he is aware that some preset changes will be lost.
|
// to notify the user whether he is aware that some preset changes will be lost.
|
||||||
bool check_unsaved_changes()
|
bool check_unsaved_changes()
|
||||||
|
@ -985,6 +1007,18 @@ wxBoxSizer* content_edit_object_buttons(wxWindow* win)
|
||||||
m_objects_ctrl->Select(m_objects_model->AddChild(item, name));
|
m_objects_ctrl->Select(m_objects_model->AddChild(item, name));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
btn_load_modifier->Bind(wxEVT_BUTTON, [win](wxEvent&)
|
||||||
|
{
|
||||||
|
on_btn_load(win, true);
|
||||||
|
// auto item = m_objects_ctrl->GetSelection();
|
||||||
|
// if (!item) return;
|
||||||
|
// if (m_objects_model->GetParent(item) != wxDataViewItem(0))
|
||||||
|
// item = m_objects_model->GetParent(item);
|
||||||
|
// if (!item) return;
|
||||||
|
// wxString name = "Part";
|
||||||
|
// m_objects_ctrl->Select(m_objects_model->AddChild(item, name));
|
||||||
|
});
|
||||||
|
|
||||||
btn_delete->Bind(wxEVT_BUTTON, [](wxEvent&)
|
btn_delete->Bind(wxEVT_BUTTON, [](wxEvent&)
|
||||||
{
|
{
|
||||||
auto item = m_objects_ctrl->GetSelection();
|
auto item = m_objects_ctrl->GetSelection();
|
||||||
|
|
|
@ -124,6 +124,8 @@ void set_label_clr_sys(const wxColour& clr);
|
||||||
const wxFont& small_font();
|
const wxFont& small_font();
|
||||||
const wxFont& bold_font();
|
const wxFont& bold_font();
|
||||||
|
|
||||||
|
wxArrayString* open_model(wxWindow *parent);
|
||||||
|
|
||||||
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);
|
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);
|
||||||
|
|
||||||
// This is called when closing the application, when loading a config file or when starting the config wizard
|
// This is called when closing the application, when loading a config file or when starting the config wizard
|
||||||
|
|
43
xs/src/slic3r/GUI/GUI_ObjectParts.cpp
Normal file
43
xs/src/slic3r/GUI/GUI_ObjectParts.cpp
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#include "GUI.hpp"
|
||||||
|
#include "GUI_ObjectParts.hpp"
|
||||||
|
|
||||||
|
#include <wx/msgdlg.h>
|
||||||
|
|
||||||
|
namespace Slic3r
|
||||||
|
{
|
||||||
|
namespace GUI
|
||||||
|
{
|
||||||
|
void on_btn_load(wxWindow* parent, bool is_modifier /*= false*/)
|
||||||
|
{
|
||||||
|
auto input_files = open_model(parent);
|
||||||
|
// for(auto input_file : input_files) {
|
||||||
|
// my $model = eval{ Slic3r::Model->read_from_file($input_file) };
|
||||||
|
// if ($@) {
|
||||||
|
// Slic3r::GUI::show_error($self, $@);
|
||||||
|
// next;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// foreach my $object(@{$model->objects}) {
|
||||||
|
// foreach my $volume(@{$object->volumes}) {
|
||||||
|
// my $new_volume = $self->{model_object}->add_volume($volume);
|
||||||
|
// $new_volume->set_modifier($is_modifier);
|
||||||
|
// $new_volume->set_name(basename($input_file));
|
||||||
|
//
|
||||||
|
// # apply the same translation we applied to the object
|
||||||
|
// $new_volume->mesh->translate(@{$self->{model_object}->origin_translation});
|
||||||
|
//
|
||||||
|
// # set a default extruder value, since user can't add it manually
|
||||||
|
// $new_volume->config->set_ifndef('extruder', 0);
|
||||||
|
//
|
||||||
|
// $self->{parts_changed} = 1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
parts_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void parts_changed(){ ; }
|
||||||
|
|
||||||
|
} //namespace GUI
|
||||||
|
} //namespace Slic3r
|
12
xs/src/slic3r/GUI/GUI_ObjectParts.hpp
Normal file
12
xs/src/slic3r/GUI/GUI_ObjectParts.hpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef slic3r_GUI_ObjectParts_hpp_
|
||||||
|
#define slic3r_GUI_ObjectParts_hpp_
|
||||||
|
|
||||||
|
namespace Slic3r
|
||||||
|
{
|
||||||
|
namespace GUI
|
||||||
|
{
|
||||||
|
void on_btn_load(wxWindow* parent, bool is_modifier = false);
|
||||||
|
void parts_changed();
|
||||||
|
} //namespace GUI
|
||||||
|
} //namespace Slic3r
|
||||||
|
#endif //slic3r_GUI_ObjectParts_hpp_
|
Loading…
Add table
Add a link
Reference in a new issue