From d3b19382fe6a035438ca93bac495a99e51fbcb4f Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 28 Jun 2018 19:16:36 +0200 Subject: [PATCH] AppController reachable trough Plater.pm --- lib/Slic3r/GUI/MainFrame.pm | 2 ++ lib/Slic3r/GUI/Plater.pm | 8 ++++++-- xs/CMakeLists.txt | 1 + xs/src/slic3r/AppController.cpp | 11 +++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index c38f324f4..2fdd7e11d 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -75,6 +75,8 @@ sub new { $appController->set_model($self->{plater}->{model}); $appController->set_print($self->{plater}->{print}); + $self->{plater}->{appController} = $appController; + $self->{loaded} = 1; # initialize layout diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 2b0a5a0d5..db51dfe38 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -45,6 +45,7 @@ use constant FILAMENT_CHOOSERS_SPACING => 0; use constant PROCESS_DELAY => 0.5 * 1000; # milliseconds my $PreventListEvents = 0; +our $appController; sub new { my ($class, $parent) = @_; @@ -1188,8 +1189,11 @@ sub arrange { $self->pause_background_process; - my $bb = Slic3r::Geometry::BoundingBoxf->new_from_points($self->{config}->bed_shape); - my $success = $self->{model}->arrange_objects(wxTheApp->{preset_bundle}->full_config->min_object_distance, $bb); + # my $bb = Slic3r::Geometry::BoundingBoxf->new_from_points($self->{config}->bed_shape); + # my $success = $self->{model}->arrange_objects(wxTheApp->{preset_bundle}->full_config->min_object_distance, $bb); + + $self->{appController}->arrange_model; + # ignore arrange failures on purpose: user has visual feedback and we don't need to warn him # when parts don't fit in print bed diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 2ddedd90e..4beb67964 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -409,6 +409,7 @@ set(XS_XSP_FILES ${XSP_DIR}/TriangleMesh.xsp ${XSP_DIR}/Utils_OctoPrint.xsp ${XSP_DIR}/Utils_PresetUpdater.xsp + ${XSP_DIR}/AppController.xsp ${XSP_DIR}/XS.xsp ) foreach (file ${XS_XSP_FILES}) diff --git a/xs/src/slic3r/AppController.cpp b/xs/src/slic3r/AppController.cpp index abc8c9736..bd7a2e702 100644 --- a/xs/src/slic3r/AppController.cpp +++ b/xs/src/slic3r/AppController.cpp @@ -296,14 +296,17 @@ void IProgressIndicator::message_fmt( void AppController::arrange_model() { std::async(supports_asynch()? std::launch::async : std::launch::deferred, - [this](){ - auto pind = progress_indicator(); + [this]() + { +// auto pind = progress_indicator(); // my $bb = Slic3r::Geometry::BoundingBoxf->new_from_points($self->{config}->bed_shape); // my $success = $self->{model}->arrange_objects(wxTheApp->{preset_bundle}->full_config->min_object_distance, $bb); - double dist = GUI::get_preset_bundle()->full_config().option("min_object_distance")->getFloat(); +// double dist = GUI::get_preset_bundle()->full_config().option("min_object_distance")->getFloat(); - std::cout << dist << std::endl; +// std::cout << dist << std::endl; + + std::cout << "ITTT vagyok" << std::endl; }); }