mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-29 03:31:17 -06:00
Merge remote-tracking branch 'origin/dev_native' into tm_sla_supports_backend
This commit is contained in:
commit
4662fd0e73
25 changed files with 503 additions and 441 deletions
|
|
@ -178,6 +178,14 @@ bool BackgroundSlicingProcess::stop()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BackgroundSlicingProcess::reset()
|
||||
{
|
||||
bool stopped = this->stop();
|
||||
this->reset_export();
|
||||
m_print->clear();
|
||||
return stopped;
|
||||
}
|
||||
|
||||
// To be called by Print::apply() through the Print::m_cancel_callback to stop the background
|
||||
// processing before changing any data of running or finalized milestones.
|
||||
// This function shall not trigger any UI update through the wxWidgets event.
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ public:
|
|||
// Cancel the background processing. Returns false if the background processing was not running.
|
||||
// A stopped background processing may be restarted with start().
|
||||
bool stop();
|
||||
// Cancel the background processing and reset the print. Returns false if the background processing was not running.
|
||||
// Useful when the Model or configuration is being changed drastically.
|
||||
bool reset();
|
||||
|
||||
// Apply config over the print. Returns false, if the new config values caused any of the already
|
||||
// processed steps to be invalidated, therefore the task will need to be restarted.
|
||||
|
|
|
|||
|
|
@ -489,7 +489,10 @@ public:
|
|||
bool is_wipe_tower() const { return m_type == WipeTower; }
|
||||
bool is_modifier() const { return (m_type == SingleModifier) || (m_type == MultipleModifier); }
|
||||
bool is_single_full_instance() const;
|
||||
bool is_multiple_full_instance() const { return m_type == MultipleFullInstance; }
|
||||
bool is_single_full_object() const { return m_type == SingleFullObject; }
|
||||
bool is_single_volume() const { return m_type == SingleVolume; }
|
||||
bool is_multiple_volume() const { return m_type == MultipleVolume; }
|
||||
bool is_mixed() const { return m_type == Mixed; }
|
||||
bool is_from_single_instance() const { return get_instance_idx() != -1; }
|
||||
bool is_from_single_object() const { return get_object_idx() != -1; }
|
||||
|
|
|
|||
|
|
@ -1598,8 +1598,9 @@ void GLGizmoSlaSupports::update_mesh()
|
|||
{
|
||||
Eigen::MatrixXf& V = m_V;
|
||||
Eigen::MatrixXi& F = m_F;
|
||||
const stl_file& stl = m_model_object->mesh().stl;
|
||||
V.resize(3*stl.stats.number_of_facets, 3);
|
||||
TriangleMesh mesh(m_model_object->mesh());
|
||||
const stl_file& stl = mesh.stl;
|
||||
V.resize(3 * stl.stats.number_of_facets, 3);
|
||||
F.resize(stl.stats.number_of_facets, 3);
|
||||
for (unsigned int i=0; i<stl.stats.number_of_facets; ++i) {
|
||||
const stl_facet* facet = stl.facet_start+i;
|
||||
|
|
|
|||
|
|
@ -286,8 +286,10 @@ void ObjectList::context_menu()
|
|||
else if (title == _("Name") && pt.x >15 &&
|
||||
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData())
|
||||
{
|
||||
if (is_windows10())
|
||||
/*fix_through_netfabb()*/;// #ys_FIXME
|
||||
if (is_windows10()) {
|
||||
const auto obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item));
|
||||
wxGetApp().plater()->fix_through_netfabb(obj_idx);
|
||||
}
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
GetMainWindow()->SetToolTip(""); // hide tooltip
|
||||
|
|
@ -1093,7 +1095,7 @@ void ObjectList::add_object_to_list(size_t obj_idx)
|
|||
|
||||
// add settings to the object, if it has those
|
||||
auto opt_keys = model_object->config.keys();
|
||||
if ( !(opt_keys.size() == 1 && opt_keys[0] == "extruder") ) {
|
||||
if (!opt_keys.empty() && !(opt_keys.size() == 1 && opt_keys[0] == "extruder")) {
|
||||
select_item(m_objects_model->AddSettingsChild(item));
|
||||
Collapse(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#include "BackgroundSlicingProcess.hpp"
|
||||
#include "ProgressStatusBar.hpp"
|
||||
#include "slic3r/Utils/ASCIIFolding.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include "../Utils/FixModelByWin10.hpp"
|
||||
|
||||
#include <wx/glcanvas.h> // Needs to be last because reasons :-/
|
||||
#include "WipeTowerDialog.hpp"
|
||||
|
|
@ -898,7 +898,7 @@ struct Plater::priv
|
|||
void start_background_process();
|
||||
void reload_from_disk();
|
||||
void export_object_stl();
|
||||
void fix_through_netfabb();
|
||||
void fix_through_netfabb(const int obj_idx);
|
||||
|
||||
void on_notebook_changed(wxBookCtrlEvent&);
|
||||
void on_select_preset(wxCommandEvent&);
|
||||
|
|
@ -1434,8 +1434,9 @@ void Plater::priv::reset()
|
|||
if (_3DScene::is_layers_editing_enabled(canvas3D))
|
||||
_3DScene::enable_layers_editing(canvas3D, false);
|
||||
|
||||
// Stop and reset the Print content.
|
||||
this->background_process.reset();
|
||||
model.clear_objects();
|
||||
// print.clear_objects();
|
||||
|
||||
// Delete all objects from list on c++ side
|
||||
sidebar->obj_list()->delete_all_objects_from_list();
|
||||
|
|
@ -1579,35 +1580,35 @@ void Plater::priv::export_object_stl()
|
|||
// TODO
|
||||
}
|
||||
|
||||
void Plater::priv::fix_through_netfabb()
|
||||
void Plater::priv::fix_through_netfabb(const int obj_idx)
|
||||
{
|
||||
/*
|
||||
my ($self) = @_;
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
return if !defined $obj_idx;
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
my $model_fixed = Slic3r::Model->new;
|
||||
Slic3r::GUI::fix_model_by_win10_sdk_gui($model_object, $self->{print}, $model_fixed);
|
||||
if (obj_idx < 0)
|
||||
return;
|
||||
|
||||
my @new_obj_idx = $self->load_model_objects(@{$model_fixed->objects});
|
||||
return if !@new_obj_idx;
|
||||
const auto model_object = model.objects[obj_idx];
|
||||
Model model_fixed;// = new Model();
|
||||
fix_model_by_win10_sdk_gui(*model_object, print, model_fixed);
|
||||
|
||||
auto new_obj_idxs = load_model_objects(model_fixed.objects);
|
||||
if (new_obj_idxs.empty())
|
||||
return;
|
||||
|
||||
foreach my $new_obj_idx (@new_obj_idx) {
|
||||
my $o = $self->{model}->objects->[$new_obj_idx];
|
||||
$o->clear_instances;
|
||||
$o->add_instance($_) for @{$model_object->instances};
|
||||
#$o->invalidate_bounding_box;
|
||||
for(auto new_obj_idx : new_obj_idxs) {
|
||||
auto o = model.objects[new_obj_idx];
|
||||
o->clear_instances();
|
||||
for (auto instance: model_object->instances)
|
||||
o->add_instance(*instance);
|
||||
// o->invalidate_bounding_box();
|
||||
|
||||
if ($o->volumes_count == $model_object->volumes_count) {
|
||||
for my $i (0..($o->volumes_count-1)) {
|
||||
$o->get_volume($i)->config->apply($model_object->get_volume($i)->config);
|
||||
if (o->volumes.size() == model_object->volumes.size()) {
|
||||
for (int i = 0; i < o->volumes.size(); i++) {
|
||||
o->volumes[i]->config.apply(model_object->volumes[i]->config);
|
||||
}
|
||||
}
|
||||
#FIXME restore volumes and their configs, layer_height_ranges, layer_height_profile, layer_height_profile_valid,
|
||||
// FIXME restore volumes and their configs, layer_height_ranges, layer_height_profile, layer_height_profile_valid,
|
||||
}
|
||||
|
||||
$self->remove($obj_idx);
|
||||
*/
|
||||
remove(obj_idx);
|
||||
}
|
||||
|
||||
void Plater::priv::on_notebook_changed(wxBookCtrlEvent&)
|
||||
|
|
@ -1970,6 +1971,8 @@ void Plater::increase_instances(size_t num)
|
|||
ModelObject* model_object = p->model.objects[obj_idx];
|
||||
ModelInstance* model_instance = model_object->instances.back();
|
||||
|
||||
bool was_one_instance = model_object->instances.size()==1;
|
||||
|
||||
float offset = 10.0;
|
||||
for (size_t i = 0; i < num; i++, offset += 10.0) {
|
||||
Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0);
|
||||
|
|
@ -1977,7 +1980,7 @@ void Plater::increase_instances(size_t num)
|
|||
// p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec));
|
||||
}
|
||||
|
||||
sidebar().obj_list()->increase_object_instances(obj_idx, num);
|
||||
sidebar().obj_list()->increase_object_instances(obj_idx, was_one_instance ? num + 1 : num);
|
||||
|
||||
if (p->get_config("autocenter") == "1") {
|
||||
p->arrange();
|
||||
|
|
@ -2000,10 +2003,8 @@ void Plater::decrease_instances(size_t num)
|
|||
|
||||
ModelObject* model_object = p->model.objects[obj_idx];
|
||||
if (model_object->instances.size() > num) {
|
||||
for (size_t i = 0; i < num; i++) {
|
||||
for (size_t i = 0; i < num; ++ i)
|
||||
model_object->delete_last_instance();
|
||||
// p->print.get_object(obj_idx)->delete_last_copy();
|
||||
}
|
||||
sidebar().obj_list()->decrease_object_instances(obj_idx, num);
|
||||
}
|
||||
else {
|
||||
|
|
@ -2287,5 +2288,6 @@ void Plater::changed_object(int obj_idx)
|
|||
|
||||
}
|
||||
|
||||
void Plater::fix_through_netfabb(const int obj_idx) { p->fix_through_netfabb(obj_idx); }
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ public:
|
|||
void export_3mf();
|
||||
void reslice();
|
||||
void changed_object(int obj_idx);
|
||||
void fix_through_netfabb(const int obj_idx);
|
||||
void send_gcode();
|
||||
|
||||
void on_extruders_change(int extruders_count);
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ wxDataViewItem PrusaObjectDataViewModel::AddInstanceChild(const wxDataViewItem &
|
|||
parent_node->Append(inst_root_node);
|
||||
// notify control
|
||||
ItemAdded(parent_item, inst_root_item);
|
||||
if (num == 1) num++;
|
||||
// if (num == 1) num++;
|
||||
}
|
||||
|
||||
// Add instance nodes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue