mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-03 18:27:59 -05:00
Make calls say whether they ask, and show Prepare after an agent's new project
Calls into the plater, object list and tabs now say in words whether they ask a person or run without prompts, instead of passing bare true/false flags. An agent's project_new now does what New Project does: it shows the Prepare tab and tells plugins about the new project.
This commit is contained in:
1 parent
529752ad0c
commit
6609ca0503
19 files changed
+159
-132
No files matched your search
+12
-5
@@ -242,11 +242,14 @@ reads the same through every route.
|
||||
|
||||
**Rules.** An operation runs on the UI thread and returns at once: background work returns a ticket and a status
|
||||
function, and the caller owns the wait, the timeout and the cancel. It takes its function's undo snapshot once, after
|
||||
its checks. It adds no guard and asks nothing: an answer a caller may give is a field of `Args`. It includes owner
|
||||
headers, libslic3r and wx, and nothing of `GUI/Mcp`, `plugin/`, JSON or pybind11; the dispatch core includes nothing
|
||||
of it. A command does what a person's action does by running the code that action runs, not by writing the model or
|
||||
the config beside it: a dialog's OK is split into a function both call, and a command that acts on the object list's
|
||||
selection selects the row first.
|
||||
its checks. It adds no guard and asks nothing: an answer a caller may give is a field of `Args`. An owner method whose
|
||||
menu item asks in a dialog takes the answer where a caller can give one (a path, a size, `keep_z`), which skips that
|
||||
dialog. For its other questions and messages it takes `Prompts`: `Ask` does as the menu item does, and `Skip` runs
|
||||
without them, each method saying what it answers in their place. An `Args` that passes the choice on holds a `Prompts`
|
||||
too. An operation includes owner headers, libslic3r and wx, and nothing of `GUI/Mcp`, `plugin/`, JSON or pybind11; the
|
||||
dispatch core includes nothing of it. A command does what a person's action does by running the code that action runs,
|
||||
not by writing the model or the config beside it: a dialog's OK is split into a function both call, and a command that
|
||||
acts on the object list's selection selects the row first.
|
||||
|
||||
**Keeping it so.** A command names the operations it reaches (`reaching()`), and the command reference lists them.
|
||||
`test_operations` requires every command outside the Design tab that is not read-only to name one, or to be on its
|
||||
@@ -494,6 +497,10 @@ has a deadline, so a server that never replies can't hang the agent.
|
||||
|
||||
## Making a feature reachable
|
||||
|
||||
A change to the GUI needs nothing for automation until someone writes its command: until then the GUI commands (GUI
|
||||
automation) reach it as a person does. A menu item of the Design tab is an entry of `tool_atlas.json` either way (A
|
||||
Design command, below).
|
||||
|
||||
A feature is a command, named for its place, then its verb (mcp-tools.md, Naming), declared in its place's file:
|
||||
|
||||
1. **Build it** with `inspect_tool()` for pure observation or `mutate_tool()` for a change, label it, give it a
|
||||
|
||||
@@ -2602,16 +2602,17 @@ static void apply_saved_primitive_size(std::vector<PrimitiveSizeDialog::Field>&
|
||||
fields[i].value = values[i];
|
||||
}
|
||||
|
||||
// The size given, when it has a value per field. Otherwise interactive starts from the size the user saved and asks
|
||||
// for the size unless the user turned the dialog off, and a call that is not interactive gets the built-in default
|
||||
// size. nullopt when the user cancels or the given size is not one for the shape (is_primitive_size()).
|
||||
static std::optional<std::vector<double>> primitive_size(const std::string& type_name, bool interactive, const std::vector<double>& given)
|
||||
// The size given, when it has a value per field. Otherwise Prompts::Ask starts from the size the user saved and asks
|
||||
// for the size unless the user turned the dialog off, and Prompts::Skip gets the built-in default size. nullopt when
|
||||
// the user cancels or the given size is not one for the shape (is_primitive_size()).
|
||||
static std::optional<std::vector<double>> primitive_size(const std::string& type_name, Ops::Prompts prompts,
|
||||
const std::vector<double>& given)
|
||||
{
|
||||
std::vector<PrimitiveSizeDialog::Field> fields = primitive_size_fields(type_name);
|
||||
if (!given.empty())
|
||||
return is_primitive_size(type_name, given) ? std::optional(given) : std::nullopt;
|
||||
AppConfig* app_config = wxGetApp().app_config;
|
||||
if (interactive && !fields.empty()) {
|
||||
if (prompts == Ops::Prompts::Ask && !fields.empty()) {
|
||||
apply_saved_primitive_size(fields, app_config->get("primitive_size", type_name));
|
||||
if (app_config->get_bool("enable_primitive_size_dialog")) {
|
||||
PrimitiveSizeDialog dlg(wxGetApp().mainframe, _L(type_name), fields);
|
||||
@@ -2667,7 +2668,7 @@ static TriangleMesh create_mesh(const std::string& type_name, const std::vector<
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void ObjectList::load_generic_subobject(const std::string& type_name, const ModelVolumeType type, bool interactive,
|
||||
void ObjectList::load_generic_subobject(const std::string& type_name, const ModelVolumeType type, Ops::Prompts prompts,
|
||||
const std::vector<double>& given_size)
|
||||
{
|
||||
// BBS: single snapshot
|
||||
@@ -2676,7 +2677,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
|
||||
if (type == ModelVolumeType::INVALID) {
|
||||
// Add Primitive adds nothing while an object is selected on the 3D scene.
|
||||
if (can_add_shape_object())
|
||||
load_shape_object(type_name, interactive, given_size);
|
||||
load_shape_object(type_name, prompts, given_size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2695,7 +2696,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
|
||||
if (instance_idx == -1)
|
||||
return;
|
||||
|
||||
const std::optional<std::vector<double>> size = primitive_size(type_name, interactive, given_size);
|
||||
const std::optional<std::vector<double>> size = primitive_size(type_name, prompts, given_size);
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
@@ -2763,7 +2764,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
|
||||
wxGetApp().params_panel()->switch_to_object(true);
|
||||
|
||||
//Show Dialog
|
||||
if (interactive && wxGetApp().app_config->get("do_not_show_modifer_tips").empty()) {
|
||||
if (prompts == Ops::Prompts::Ask && wxGetApp().app_config->get("do_not_show_modifer_tips").empty()) {
|
||||
TipsDialog dlg(wxGetApp().mainframe, _L("Add Modifier"), _L("Switch to per-object setting mode to edit modifier settings."), "do_not_show_modifer_tips");
|
||||
dlg.ShowModal();
|
||||
}
|
||||
@@ -2785,13 +2786,13 @@ bool ObjectList::can_add_shape_object() const
|
||||
return wxGetApp().plater()->canvas3D()->get_selection().get_object_idx() == -1;
|
||||
}
|
||||
|
||||
void ObjectList::load_shape_object(const std::string &type_name, bool interactive, const std::vector<double>& given_size)
|
||||
void ObjectList::load_shape_object(const std::string &type_name, Ops::Prompts prompts, const std::vector<double>& given_size)
|
||||
{
|
||||
const int obj_idx = m_objects->size();
|
||||
if (obj_idx < 0)
|
||||
return;
|
||||
|
||||
const std::optional<std::vector<double>> size = primitive_size(type_name, interactive, given_size);
|
||||
const std::optional<std::vector<double>> size = primitive_size(type_name, prompts, given_size);
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
@@ -6173,9 +6174,10 @@ static void move_volume_to_end(ModelObject* obj, ModelVolume* volume)
|
||||
}
|
||||
}
|
||||
|
||||
wxString ObjectList::set_volume_type(ModelVolumeType new_type, bool preserve_ps_subtype, bool show_errors,
|
||||
wxString ObjectList::set_volume_type(ModelVolumeType new_type, bool preserve_ps_subtype, Ops::Prompts prompts,
|
||||
const std::vector<std::pair<int, int>>& parts)
|
||||
{
|
||||
const bool show_errors = prompts == Ops::Prompts::Ask;
|
||||
struct VolumeSelection {
|
||||
int object_idx;
|
||||
ModelVolume* volume;
|
||||
@@ -6255,7 +6257,7 @@ wxString ObjectList::set_volume_type(ModelVolumeType new_type, bool preserve_ps_
|
||||
// Support entries in the old choice dialog; the UI-side guard for the current submenu lives
|
||||
// in MenuFactory::append_menu_item_change_type, see #13120).
|
||||
// The same rationale applies to any Precise Seam subtype.
|
||||
// The menu never offers these types for such parts, so reaching this block from it (show_errors)
|
||||
// The menu never offers these types for such parts, so reaching this block from it (Prompts::Ask)
|
||||
// means the UI guard has been bypassed and should be investigated. The Speed Dial's type
|
||||
// commands have no such guard and report the reason instead.
|
||||
if (new_type == ModelVolumeType::SUPPORT_BLOCKER || new_type == ModelVolumeType::SUPPORT_ENFORCER
|
||||
|
||||
@@ -363,13 +363,13 @@ public:
|
||||
//void load_part(ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false);
|
||||
void load_modifier(const wxArrayString& input_files, ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false,
|
||||
std::string* error = nullptr);
|
||||
// size, in the order the size dialog asks for the dimensions, skips the dialog. Without it, interactive uses the size the
|
||||
// user enters or saved as default; otherwise the shape gets its built-in default size. Only interactive shows the tips
|
||||
// dialog after adding a part.
|
||||
void load_generic_subobject(const std::string& type_name, const ModelVolumeType type, bool interactive = true,
|
||||
const std::vector<double>& size = {});
|
||||
// size, in the order the size dialog asks for the dimensions, skips the dialog. Without it, Prompts::Ask uses the size
|
||||
// the user enters or saved as default, and Prompts::Skip the shape's built-in default size. Only Prompts::Ask shows the
|
||||
// tips dialog after adding a part.
|
||||
void load_generic_subobject(const std::string& type_name, const ModelVolumeType type,
|
||||
Ops::Prompts prompts = Ops::Prompts::Ask, const std::vector<double>& size = {});
|
||||
// Adds the shape as a new object, whatever is selected.
|
||||
void load_shape_object(const std::string &type_name, bool interactive, const std::vector<double>& size = {});
|
||||
void load_shape_object(const std::string &type_name, Ops::Prompts prompts, const std::vector<double>& size = {});
|
||||
// Whether Add Primitive (load_generic_subobject() of no part type) adds an object now: not while an object is
|
||||
// selected, whose Add Part menu adds shapes.
|
||||
bool can_add_shape_object() const;
|
||||
@@ -521,8 +521,8 @@ public:
|
||||
// by the "Precise Seam Type" subtype picker where the user explicitly wants CENTER.
|
||||
// The parts changed are `parts`, [object, part] by their index in the model, else the selected ones.
|
||||
// Returns why the parts kept their type, empty when they changed or already had it.
|
||||
// show_errors shows that reason as the menu always has; automation passes false and reports it.
|
||||
wxString set_volume_type(ModelVolumeType new_type, bool preserve_ps_subtype = true, bool show_errors = true,
|
||||
// Prompts::Ask shows that reason as the menu always has; automation passes Prompts::Skip and reports it.
|
||||
wxString set_volume_type(ModelVolumeType new_type, bool preserve_ps_subtype = true, Ops::Prompts prompts = Ops::Prompts::Ask,
|
||||
const std::vector<std::pair<int, int>>& parts = {});
|
||||
ModelVolumeType get_selected_volume_type();
|
||||
|
||||
|
||||
@@ -662,7 +662,7 @@ json add_part(Plater& plater, int oi, const json& args)
|
||||
if (!error.empty())
|
||||
throw ToolFailure("The file could not be loaded: " + error);
|
||||
} else
|
||||
list->load_generic_subobject(shape_type_name(shape), type, false, size);
|
||||
list->load_generic_subobject(shape_type_name(shape), type, Ops::Prompts::Skip, size);
|
||||
const auto added = std::find_if(object->volumes.begin(), object->volumes.end(),
|
||||
[&before](const ModelVolume* v) { return before.count(v) == 0; });
|
||||
if (added == object->volumes.end())
|
||||
@@ -1290,7 +1290,7 @@ AppActionRunResult split_command(const json& args)
|
||||
op.expand = found.value().object_row;
|
||||
}
|
||||
op.to_objects = to_objects;
|
||||
op.ask = asks;
|
||||
op.prompts = asks ? Ops::Prompts::Ask : Ops::Prompts::Skip;
|
||||
if (args.contains("keep_z"))
|
||||
op.keep_z = args.at("keep_z").get<bool>();
|
||||
const Ops::Outcome<Targets> made = Ops::split_object(op);
|
||||
@@ -1583,7 +1583,7 @@ AppActionRunResult add_primitive_command(const json& args)
|
||||
// The size first: it refuses a shape of another name, which shape_type_name() has none for.
|
||||
op.size = part_shape_size(shape, args.value("size", json()));
|
||||
op.shape = shape_type_name(shape);
|
||||
op.ask = args == json{{"shape", shape}};
|
||||
op.prompts = args == json{{"shape", shape}} ? Ops::Prompts::Ask : Ops::Prompts::Skip;
|
||||
if (args.contains("plate"))
|
||||
op.plate = arg_int(args, "plate", 0);
|
||||
if (args.contains("name"))
|
||||
@@ -1595,7 +1595,8 @@ AppActionRunResult add_primitive_command(const json& args)
|
||||
const Ops::Outcome<int> added = Ops::add_primitive(op);
|
||||
if (!added)
|
||||
// The size dialog cancelled told the person nothing more is to come.
|
||||
return op.ask && std::string(added.refusal().code) == "not_added" ? quiet_refusal(added.refusal()) : menu_refused(added.refusal());
|
||||
return op.prompts == Ops::Prompts::Ask && std::string(added.refusal().code) == "not_added" ? quiet_refusal(added.refusal())
|
||||
: menu_refused(added.refusal());
|
||||
const int index = added.value();
|
||||
Targets made;
|
||||
made.objects = {index};
|
||||
|
||||
@@ -1596,24 +1596,24 @@ void register_plate_tools(CommandCatalog& catalog)
|
||||
const DynamicPrintConfig filament_before = bundle.filaments.get_edited_preset().config;
|
||||
const DynamicPrintConfig printer_before = bundle.printers.get_edited_preset().config;
|
||||
switch (params.mode) {
|
||||
case CalibMode::Calib_Temp_Tower: plater.calib_temp(params, true); break;
|
||||
case CalibMode::Calib_Vol_speed_Tower: plater.calib_max_vol_speed(params, true); break;
|
||||
case CalibMode::Calib_Temp_Tower: plater.calib_temp(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_Vol_speed_Tower: plater.calib_max_vol_speed(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_PA_Tower:
|
||||
case CalibMode::Calib_PA_Line:
|
||||
case CalibMode::Calib_PA_Pattern: plater.calib_pa(params, true); break;
|
||||
case CalibMode::Calib_PA_Pattern: plater.calib_pa(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_Flow_Rate: {
|
||||
const std::string method = arg_string(args, "method", "yolo");
|
||||
plater.calib_flowrate(method == "yolo" || method == "yolo_perfectionist",
|
||||
method == "pass2" || method == "yolo_perfectionist" ? 2 : 1,
|
||||
arg_string(args, "top_surface_pattern") == "monotonic" ? ipMonotonic : ipArchimedeanChords,
|
||||
params.filament_id, params.extruder_id, true);
|
||||
params.filament_id, params.extruder_id, Ops::Prompts::Skip);
|
||||
break;
|
||||
}
|
||||
case CalibMode::Calib_Retraction_tower: plater.calib_retraction(params, true); break;
|
||||
case CalibMode::Calib_VFA_Tower: plater.calib_VFA(params, true); break;
|
||||
case CalibMode::Calib_Input_shaping_freq: plater.calib_input_shaping_freq(params, true); break;
|
||||
case CalibMode::Calib_Input_shaping_damp: plater.calib_input_shaping_damp(params, true); break;
|
||||
case CalibMode::Calib_Cornering: plater.Calib_Cornering(params, true); break;
|
||||
case CalibMode::Calib_Retraction_tower: plater.calib_retraction(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_VFA_Tower: plater.calib_VFA(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_Input_shaping_freq: plater.calib_input_shaping_freq(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_Input_shaping_damp: plater.calib_input_shaping_damp(params, Ops::Prompts::Skip); break;
|
||||
case CalibMode::Calib_Cornering: plater.Calib_Cornering(params, Ops::Prompts::Skip); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
@@ -2263,7 +2263,7 @@ void register_preset_tools(CommandCatalog& catalog)
|
||||
// With a physical printer selected, the tab's Delete only takes the preset off that printer.
|
||||
if (TabPresetComboBox* combo = tab->get_combo_box(); type == Preset::TYPE_PRINTER && combo != nullptr && combo->is_selected_physical_printer())
|
||||
throw ToolFailure("A physical printer is selected; select the printer preset itself first");
|
||||
tab->delete_preset(false);
|
||||
tab->delete_preset(Ops::Prompts::Skip);
|
||||
} else if (type == Preset::TYPE_PRINTER) {
|
||||
// Switching to another printer and back recomputes the process and the filaments, so it is no round trip.
|
||||
throw ToolFailure("\"" + name + "\" is not the selected printer; select it first with preset_select");
|
||||
@@ -2282,7 +2282,7 @@ void register_preset_tools(CommandCatalog& catalog)
|
||||
if (!tab->select_preset(name))
|
||||
throw ToolFailure("Selecting \"" + name + "\" to delete it was cancelled");
|
||||
if (presets.get_selected_preset_name() == name)
|
||||
tab->delete_preset(false);
|
||||
tab->delete_preset(Ops::Prompts::Skip);
|
||||
if (presets.get_selected_preset_name() != selected)
|
||||
tab->select_preset(selected);
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ Outcome<Targets> split_object(const SplitObjectArgs& args)
|
||||
const int object = args.target.objects.empty() ? args.target.parts.front().first : args.target.objects.front();
|
||||
if (args.to_objects) {
|
||||
const std::size_t before = model.objects.size();
|
||||
switch (plater.split_object(object, args.ask, args.keep_z)) {
|
||||
switch (plater.split_object(object, args.prompts, args.keep_z)) {
|
||||
case Plater::SplitResult::OnePiece:
|
||||
return Refusal{RefusalKind::Precondition, "one_piece", L("The selected object couldn't be split.")};
|
||||
case Plater::SplitResult::Unanswered:
|
||||
@@ -570,7 +570,7 @@ Outcome<Targets> change_part_type(const ChangePartTypeArgs& args)
|
||||
for (const auto& [object, part] : args.targets.parts)
|
||||
volumes.push_back(model.objects[std::size_t(object)]->volumes[std::size_t(part)]);
|
||||
// A subtype given is set as the Precise Seam Type menu sets it; without one a seam keeps its own.
|
||||
if (const wxString kept = wxGetApp().obj_list()->set_volume_type(args.subtype.value_or(args.type), !args.subtype, /*show_errors=*/false,
|
||||
if (const wxString kept = wxGetApp().obj_list()->set_volume_type(args.subtype.value_or(args.type), !args.subtype, Prompts::Skip,
|
||||
args.targets.parts);
|
||||
!kept.empty())
|
||||
// A reason of the object list's that part_type_refusal() does not foresee.
|
||||
@@ -881,11 +881,11 @@ Outcome<int> add_primitive(const AddPrimitiveArgs& args)
|
||||
if (const Outcome<Done> selected = select_plate({*args.plate}); !selected)
|
||||
return selected.refusal();
|
||||
ObjectList& list = *wxGetApp().obj_list();
|
||||
if (args.ask && !list.can_add_shape_object())
|
||||
if (args.prompts == Prompts::Ask && !list.can_add_shape_object())
|
||||
return Refusal{RefusalKind::Precondition, "object_selected",
|
||||
L("Deselect all objects to add a primitive object. To add a shape to the selected object, use its Add Part menu.")};
|
||||
const std::size_t before = plater.model().objects.size();
|
||||
list.load_shape_object(args.shape, args.ask, args.size);
|
||||
list.load_shape_object(args.shape, args.prompts, args.size);
|
||||
if (plater.model().objects.size() == before)
|
||||
return Refusal{RefusalKind::Failed, "not_added", L("No object was added.")};
|
||||
const int index = int(before);
|
||||
|
||||
@@ -159,8 +159,8 @@ struct SplitObjectArgs
|
||||
Targets target; // one object, or for parts one part of it
|
||||
bool to_objects = true; // into objects, else into parts
|
||||
std::optional<bool> keep_z; // the answer to Split's Auto-Drop question: true keeps the height of what floats
|
||||
bool ask = false; // with keep_z none, the question is asked, and a message tells an object of one
|
||||
// piece, as Split does; else the split is refused for them
|
||||
Prompts prompts = Prompts::Skip; // with keep_z none and Ask, the question is asked, and a message tells an
|
||||
// object of one piece, as Split does; with Skip the split is refused for them
|
||||
bool expand = false; // into parts, the object's row is opened on its parts, as a split from that row
|
||||
// opens it
|
||||
};
|
||||
@@ -322,7 +322,8 @@ struct AddPrimitiveArgs
|
||||
std::optional<std::string> name; // its name (rename_object()); none: its shape's
|
||||
std::optional<Vec3d> position; // where its first instance goes, in bed coordinates, as object_transform's
|
||||
// position, after which it rests on the bed; none: where Add Primitive puts it
|
||||
bool ask = false; // as Add Primitive: refused while an object is selected, and the size dialog asks
|
||||
Prompts prompts = Prompts::Skip; // Ask: as Add Primitive, refused while an object is selected, and
|
||||
// the size dialog asks
|
||||
};
|
||||
// Adds the shape as a new object, as Add Primitive does in the Prepare view, the view shown first, named and placed, in
|
||||
// one undo step, and selects it. Returns its index.
|
||||
|
||||
@@ -55,6 +55,12 @@ private:
|
||||
struct Done
|
||||
{};
|
||||
|
||||
// Whether a call puts its questions and messages to a person (Ask), as the menu item it stands for does, or runs
|
||||
// without them (Skip), for a caller with no one to ask that has the answers already or reports what happened
|
||||
// itself. Each function taking it says what Skip answers for it. Methods of the plater, the object list and the
|
||||
// tabs take it, as do the operations' arguments that pass it on to them.
|
||||
enum class Prompts { Ask, Skip };
|
||||
|
||||
// The names of `candidates` closest to `name`, for a refusal of a name none has: those holding more of its words
|
||||
// first, then those fewer edits away, at most eight. Any case.
|
||||
std::vector<std::string> closest_names(std::vector<std::string> candidates, const std::string& name);
|
||||
|
||||
@@ -141,7 +141,7 @@ Outcome<ProjectSummary> open_project(const OpenProjectArgs& args)
|
||||
// Dropped here, so Plater::load_project() finds nothing to ask about; the reset tells no plugin
|
||||
// and switches no tab, since the project that counts is the one about to load.
|
||||
if (plater.is_project_dirty())
|
||||
plater.new_project(/*skip_confirm=*/true, /*silent=*/true);
|
||||
plater.new_project(Prompts::Skip, /*silent=*/true);
|
||||
// The project with its settings, as opening one is asked for: the load-behaviour preference, which can load the
|
||||
// geometry alone or ask how to open it, is a person's choice for the files they open themselves.
|
||||
plater.load_project(from_path(args.path), "<loadall>");
|
||||
@@ -157,7 +157,7 @@ Outcome<ProjectSummary> new_project(const NewProjectArgs& args)
|
||||
// reloads the presets, which can ask about the printer's.
|
||||
if (args.discard_preset_changes && wxGetApp().has_current_preset_changes())
|
||||
wxGetApp().discard_current_preset_changes();
|
||||
plater.new_project(/*skip_confirm=*/true, /*silent=*/true, wxString(), /*reload_presets=*/true, /*tell_plugins=*/true);
|
||||
plater.new_project(Prompts::Skip);
|
||||
return summary(plater);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,8 +83,8 @@ struct NewProjectArgs
|
||||
UnsavedChanges unsaved = UnsavedChanges::Refuse;
|
||||
bool discard_preset_changes = false; // drop the presets' unsaved changes first; else they carry over
|
||||
};
|
||||
// Starts a new, empty project without a question. Plugins get the NewProject event; the shown tab
|
||||
// stays as it is.
|
||||
// Starts a new, empty project without a question, as New Project does otherwise: the Prepare tab shows, and plugins
|
||||
// get the NewProject event.
|
||||
// Refuses: unsaved_changes.
|
||||
Outcome<ProjectSummary> new_project(const NewProjectArgs& args);
|
||||
|
||||
|
||||
+48
-44
@@ -7662,9 +7662,10 @@ struct Plater::priv
|
||||
void drop_selection();
|
||||
void mirror(Axis axis);
|
||||
void split_object(bool auto_drop = true);
|
||||
// Plater::split_object(obj_idx, ask, keep_z), whose split loads the objects with `auto_drop` unless the question
|
||||
// Plater::split_object(obj_idx, prompts, keep_z), whose split loads the objects with `auto_drop` unless the question
|
||||
// answers otherwise.
|
||||
SplitResult split_object(int obj_idx, bool auto_drop = true, bool ask = true, std::optional<bool> keep_z = std::nullopt);
|
||||
SplitResult split_object(int obj_idx, bool auto_drop = true, Ops::Prompts prompts = Ops::Prompts::Ask,
|
||||
std::optional<bool> keep_z = std::nullopt);
|
||||
void split_volume();
|
||||
void scale_selection_to_fit_print_volume();
|
||||
|
||||
@@ -7750,15 +7751,15 @@ struct Plater::priv
|
||||
bool export_gcode(fs::path output_path, bool output_path_on_removable_media, bool tracked = false);
|
||||
void export_gcode(fs::path output_path, bool output_path_on_removable_media, PrintHostJob upload_job);
|
||||
|
||||
// Reload from disk of `parts`, else of the selection's parts. With `ask`, a file that is gone is asked for, a part its
|
||||
// file has none for is told in a message box, and a file that cannot be read ends the reload where it is; without it
|
||||
// nothing is asked or told, and the reload goes on to update the scene.
|
||||
ReloadResult reload_from_disk(const std::vector<std::pair<int, int>>* parts = nullptr, bool ask = true);
|
||||
// With `tell`, a file of several parts is told in a message box.
|
||||
// Reload from disk of `parts`, else of the selection's parts. With Prompts::Ask, a file that is gone is asked for, a
|
||||
// part its file has none for is told in a message box, and a file that cannot be read ends the reload where it is;
|
||||
// with Prompts::Skip nothing is asked or told, and the reload goes on to update the scene.
|
||||
ReloadResult reload_from_disk(const std::vector<std::pair<int, int>>* parts = nullptr, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
// With Prompts::Ask, a file of several parts is told in a message box.
|
||||
ReplaceResult replace_volume_with_stl(int object_idx, int volume_idx, const fs::path& new_path, const std::string& snapshot = "",
|
||||
bool tell = true);
|
||||
Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
// replace_volume_with_stl() in its own "Replace with 3D file" undo step, then the 3D scene and its printable states.
|
||||
ReplaceResult replace_part(int object_idx, int volume_idx, const fs::path& new_path, bool tell);
|
||||
ReplaceResult replace_part(int object_idx, int volume_idx, const fs::path& new_path, Ops::Prompts prompts);
|
||||
void replace_with_stl();
|
||||
void replace_all_with_stl();
|
||||
void reload_all_from_disk();
|
||||
@@ -8528,7 +8529,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
if (this->q->get_project_filename().IsEmpty() && this->q->is_empty_project()) {
|
||||
int skip_confirm = e.GetInt();
|
||||
// Skips the preset reload; trigger_restore_project()'s callers load the presets first.
|
||||
this->q->new_project(skip_confirm, true, wxString(), false);
|
||||
this->q->new_project(skip_confirm ? Ops::Prompts::Skip : Ops::Prompts::Ask, /*silent=*/true, wxString(),
|
||||
/*reload_presets=*/false);
|
||||
}
|
||||
});
|
||||
//wxPostEvent(this->q, wxCommandEvent{EVT_RESTORE_PROJECT});
|
||||
@@ -11438,9 +11440,10 @@ void Plater::priv::split_object(bool auto_drop /* = true */)
|
||||
}
|
||||
|
||||
// split provided object into multiple objects by its volumes
|
||||
Plater::SplitResult Plater::priv::split_object(int obj_idx, bool auto_drop /* = true */, bool ask /* = true */,
|
||||
Plater::SplitResult Plater::priv::split_object(int obj_idx, bool auto_drop /* = true */, Ops::Prompts prompts /* = Ask */,
|
||||
std::optional<bool> keep_z /* = std::nullopt */)
|
||||
{
|
||||
const bool ask = prompts == Ops::Prompts::Ask;
|
||||
if (obj_idx == -1)
|
||||
return SplitResult::OnePiece;
|
||||
|
||||
@@ -12288,7 +12291,7 @@ void Plater::priv::update_sla_scene()
|
||||
}
|
||||
|
||||
Plater::ReplaceResult Plater::priv::replace_volume_with_stl(int object_idx, int volume_idx, const fs::path& new_path,
|
||||
const std::string& snapshot, bool tell)
|
||||
const std::string& snapshot, Ops::Prompts prompts)
|
||||
{
|
||||
const std::string path = new_path.string();
|
||||
wxBusyCursor wait;
|
||||
@@ -12341,7 +12344,7 @@ Plater::ReplaceResult Plater::priv::replace_volume_with_stl(int object_idx, int
|
||||
if (new_model.objects.empty())
|
||||
return ReplaceResult::Unreadable;
|
||||
if (const std::optional<Ops::Refusal> refusal = Ops::replacement_refusal(new_model)) {
|
||||
if (tell) {
|
||||
if (prompts == Ops::Prompts::Ask) {
|
||||
MessageDialog dlg(q, refusal->translated(), _L("Error during replacement"), wxOK | wxOK_DEFAULT | wxICON_WARNING);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
@@ -12404,9 +12407,9 @@ Plater::ReplaceResult Plater::priv::replace_volume_with_stl(int object_idx, int
|
||||
return ReplaceResult::Replaced;
|
||||
}
|
||||
|
||||
Plater::ReplaceResult Plater::priv::replace_part(int object_idx, int volume_idx, const fs::path& new_path, bool tell)
|
||||
Plater::ReplaceResult Plater::priv::replace_part(int object_idx, int volume_idx, const fs::path& new_path, Ops::Prompts prompts)
|
||||
{
|
||||
const ReplaceResult result = replace_volume_with_stl(object_idx, volume_idx, new_path, _u8L("Replace with 3D file"), tell);
|
||||
const ReplaceResult result = replace_volume_with_stl(object_idx, volume_idx, new_path, _u8L("Replace with 3D file"), prompts);
|
||||
if (result != ReplaceResult::Replaced)
|
||||
return result;
|
||||
|
||||
@@ -12456,7 +12459,7 @@ void Plater::priv::replace_with_stl()
|
||||
return;
|
||||
}
|
||||
|
||||
replace_part(object_idx, volume_idx, out_path, true);
|
||||
replace_part(object_idx, volume_idx, out_path, Ops::Prompts::Ask);
|
||||
}
|
||||
|
||||
void Plater::priv::replace_all_with_stl()
|
||||
@@ -12606,8 +12609,9 @@ static std::vector<std::pair<int, int>> reloadable_volumes(const Model &model, c
|
||||
}
|
||||
#endif // ENABLE_RELOAD_FROM_DISK_REWORK
|
||||
|
||||
Plater::ReloadResult Plater::priv::reload_from_disk(const std::vector<std::pair<int, int>>* parts, bool ask)
|
||||
Plater::ReloadResult Plater::priv::reload_from_disk(const std::vector<std::pair<int, int>>* parts, Ops::Prompts prompts)
|
||||
{
|
||||
const bool ask = prompts == Ops::Prompts::Ask;
|
||||
ReloadResult result;
|
||||
#if ENABLE_RELOAD_FROM_DISK_REWORK
|
||||
// collect selected reloadable ModelVolumes
|
||||
@@ -16676,7 +16680,7 @@ Print& Plater::fff_print() { return p->fff_print; }
|
||||
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
|
||||
SLAPrint& Plater::sla_print() { return p->sla_print; }
|
||||
|
||||
int Plater::new_project(bool skip_confirm, bool silent, const wxString& project_name, bool reload_presets, bool tell_plugins)
|
||||
int Plater::new_project(Ops::Prompts prompts, bool silent, const wxString& project_name, bool reload_presets)
|
||||
{
|
||||
bool transfer_preset_changes = false;
|
||||
// BBS: save confirm
|
||||
@@ -16696,7 +16700,7 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString& project_
|
||||
return result;
|
||||
};
|
||||
int result;
|
||||
if (!skip_confirm && (result = close_with_confirm(check)) == wxID_CANCEL)
|
||||
if (prompts == Ops::Prompts::Ask && (result = close_with_confirm(check)) == wxID_CANCEL)
|
||||
return wxID_CANCEL;
|
||||
|
||||
// Only once the question has let the current project go: Cancel keeps them, and Save writes them to its file.
|
||||
@@ -16714,7 +16718,7 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString& project_
|
||||
//get_partplate_list().reinit();
|
||||
//get_partplate_list().update_slice_context_to_current_plate(p->background_process);
|
||||
//p->preview->update_gcode_result(p->partplate_list.get_current_slice_result());
|
||||
if (!silent || tell_plugins) {
|
||||
if (!silent) {
|
||||
Slic3r::LifecycleEventContext ctx;
|
||||
ctx.code = Slic3r::LifecycleEvtCode::Ok;
|
||||
Slic3r::fire_lifecycle_event(Slic3r::LifecycleEvent::NewProject, ctx);
|
||||
@@ -17516,7 +17520,7 @@ void Plater::_calib_assign_filament(int filament_id)
|
||||
sidebar().obj_list()->update_filament_values_for_items(size_t(wxGetApp().filaments_cnt()));
|
||||
}
|
||||
|
||||
void Plater::calib_pa(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::calib_pa(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
// ORCA-Belt: PA Line / PA Pattern have the belt plumbing in place
|
||||
// (belt kinematics in world-coordinates mode draws them on the belt surface)
|
||||
@@ -17532,7 +17536,7 @@ void Plater::calib_pa(const Calib_Params& params, bool skip_confirm)
|
||||
}
|
||||
}
|
||||
const auto calib_pa_name = _L("Pressure Advance Test");
|
||||
if (new_project(skip_confirm, false, calib_pa_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_pa_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -17673,7 +17677,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
auto cur_plate = get_partplate_list().get_plate(0);
|
||||
|
||||
// add "handle" cube
|
||||
sidebar().obj_list()->load_generic_subobject("Cube", ModelVolumeType::INVALID, false);
|
||||
sidebar().obj_list()->load_generic_subobject("Cube", ModelVolumeType::INVALID, Ops::Prompts::Skip);
|
||||
auto *cube = model().objects[0];
|
||||
|
||||
CalibPressureAdvancePattern pa_pattern(
|
||||
@@ -18013,7 +18017,7 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i
|
||||
}
|
||||
|
||||
// ORCA: Add pattern parameter
|
||||
void Plater::calib_flowrate(bool is_linear, int pass, InfillPattern pattern, int filament_id, int extruder_id, bool skip_confirm) {
|
||||
void Plater::calib_flowrate(bool is_linear, int pass, InfillPattern pattern, int filament_id, int extruder_id, Ops::Prompts prompts) {
|
||||
if (pass != 1 && pass != 2)
|
||||
return;
|
||||
wxString calib_name;
|
||||
@@ -18022,7 +18026,7 @@ void Plater::calib_flowrate(bool is_linear, int pass, InfillPattern pattern, int
|
||||
} else
|
||||
calib_name = wxString::Format(_L("Flowrate Test - Pass%d"), pass);
|
||||
|
||||
if (new_project(skip_confirm, false, calib_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_name) == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
@@ -18063,7 +18067,7 @@ void Plater::calib_flowrate(bool is_linear, int pass, InfillPattern pattern, int
|
||||
bool Plater::is_flowrate_calib() const { return p->m_flowrate_calib; }
|
||||
|
||||
|
||||
void Plater::calib_temp(const Calib_Params& params, bool skip_confirm) {
|
||||
void Plater::calib_temp(const Calib_Params& params, Ops::Prompts prompts) {
|
||||
constexpr double base_temp_tower_nozzle_diameter = 0.4;
|
||||
constexpr double base_temp_tower_block_height = 10.0;
|
||||
constexpr int base_temp_tower_temp_step = 5;
|
||||
@@ -18086,7 +18090,7 @@ void Plater::calib_temp(const Calib_Params& params, bool skip_confirm) {
|
||||
}
|
||||
|
||||
const auto calib_temp_name = _L("Nozzle temperature test");
|
||||
if (new_project(skip_confirm, false, calib_temp_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_temp_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18362,10 +18366,10 @@ void Plater::_calib_temp_belt_sectioned(const Calib_Params& params, double belt_
|
||||
p->background_process.fff_print()->set_calib_params(params);
|
||||
}
|
||||
|
||||
void Plater::calib_max_vol_speed(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::calib_max_vol_speed(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
const auto calib_vol_speed_name = _L("Max volumetric speed test");
|
||||
if (new_project(skip_confirm, false, calib_vol_speed_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_vol_speed_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18448,10 +18452,10 @@ void Plater::calib_max_vol_speed(const Calib_Params& params, bool skip_confirm)
|
||||
p->background_process.fff_print()->set_calib_params(new_params);
|
||||
}
|
||||
|
||||
void Plater::calib_retraction(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::calib_retraction(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
const auto calib_retraction_name = _L("Retraction");
|
||||
if (new_project(skip_confirm, false, calib_retraction_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_retraction_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18516,10 +18520,10 @@ void Plater::calib_retraction(const Calib_Params& params, bool skip_confirm)
|
||||
p->background_process.fff_print()->set_calib_params(params);
|
||||
}
|
||||
|
||||
void Plater::calib_VFA(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::calib_VFA(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
const auto calib_vfa_name = _L("VFA test");
|
||||
if (new_project(skip_confirm, false, calib_vfa_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_vfa_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18604,10 +18608,10 @@ void Plater::calib_VFA(const Calib_Params& params, bool skip_confirm)
|
||||
p->background_process.fff_print()->set_calib_params(calib_params);
|
||||
}
|
||||
|
||||
void Plater::calib_input_shaping_freq(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::calib_input_shaping_freq(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
const auto calib_input_shaping_name = _L("Input shaping Frequency test");
|
||||
if (new_project(skip_confirm, false, calib_input_shaping_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_input_shaping_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18676,10 +18680,10 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params, bool skip_conf
|
||||
p->background_process.fff_print()->set_calib_params(params);
|
||||
}
|
||||
|
||||
void Plater::calib_input_shaping_damp(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::calib_input_shaping_damp(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
const auto calib_input_shaping_name = _L("Input shaping Damping test");
|
||||
if (new_project(skip_confirm, false, calib_input_shaping_name) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, calib_input_shaping_name) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18747,10 +18751,10 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params, bool skip_conf
|
||||
p->background_process.fff_print()->set_calib_params(params);
|
||||
}
|
||||
|
||||
void Plater::Calib_Cornering(const Calib_Params& params, bool skip_confirm)
|
||||
void Plater::Calib_Cornering(const Calib_Params& params, Ops::Prompts prompts)
|
||||
{
|
||||
const auto Calib_Cornering = _L("Cornering test");
|
||||
if (new_project(skip_confirm, false, Calib_Cornering) == wxID_CANCEL)
|
||||
if (new_project(prompts, /*silent=*/false, Calib_Cornering) == wxID_CANCEL)
|
||||
return;
|
||||
wxGetApp().mainframe->select_tab(TAB_ID_PREPARE);
|
||||
if (!_calib_select_filament(params.filament_id))
|
||||
@@ -18900,9 +18904,9 @@ void Plater::load_gcode(const wxString& filename)
|
||||
auto check = [](bool yes_or_no) {
|
||||
return yes_or_no || wxGetApp().check_and_save_current_preset_changes(_L("Load project"), _L("Some presets are modified."));
|
||||
};
|
||||
if (close_with_confirm(check) == wxID_CANCEL || new_project(true, true) != wxID_YES)
|
||||
if (close_with_confirm(check) == wxID_CANCEL || new_project(Ops::Prompts::Skip, /*silent=*/true) != wxID_YES)
|
||||
return;
|
||||
} else if (new_project(false, true) != wxID_YES)
|
||||
} else if (new_project(Ops::Prompts::Ask, /*silent=*/true) != wxID_YES)
|
||||
return;
|
||||
|
||||
m_only_gcode = true;
|
||||
@@ -21608,7 +21612,7 @@ void Plater::reload_from_disk()
|
||||
|
||||
Plater::ReloadResult Plater::reload_parts_from_disk(const std::vector<std::pair<int, int>>& parts)
|
||||
{
|
||||
return p->reload_from_disk(&parts, false);
|
||||
return p->reload_from_disk(&parts, Ops::Prompts::Skip);
|
||||
}
|
||||
|
||||
void Plater::replace_with_stl()
|
||||
@@ -21618,7 +21622,7 @@ void Plater::replace_with_stl()
|
||||
|
||||
Plater::ReplaceResult Plater::replace_part_with_file(int object_idx, int volume_idx, const std::string& path)
|
||||
{
|
||||
return p->replace_part(object_idx, volume_idx, fs::path(path), false);
|
||||
return p->replace_part(object_idx, volume_idx, fs::path(path), Ops::Prompts::Skip);
|
||||
}
|
||||
|
||||
void Plater::replace_all_with_stl()
|
||||
@@ -23295,7 +23299,7 @@ void Plater::center_selection() { p->center_selection(); }
|
||||
void Plater::drop_selection() { p->drop_selection(); }
|
||||
void Plater::mirror(Axis axis) { p->mirror(axis); }
|
||||
void Plater::split_object(bool auto_drop) { p->split_object(auto_drop); }
|
||||
Plater::SplitResult Plater::split_object(int obj_idx, bool ask, std::optional<bool> keep_z) { return p->split_object(obj_idx, true, ask, keep_z); }
|
||||
Plater::SplitResult Plater::split_object(int obj_idx, Ops::Prompts prompts, std::optional<bool> keep_z) { return p->split_object(obj_idx, true, prompts, keep_z); }
|
||||
void Plater::split_volume() { p->split_volume(); }
|
||||
void Plater::optimize_rotation()
|
||||
{
|
||||
|
||||
+18
-17
@@ -431,10 +431,11 @@ public:
|
||||
// Helper: returns config indices where filament_is_mixed == false
|
||||
std::vector<size_t> physical_filament_config_indices() const;
|
||||
|
||||
// `silent` leaves the shown tab as it is and sends plugins no NewProject event; `tell_plugins` sends
|
||||
// the event all the same, for a silent caller whose new project is one a person asked for.
|
||||
int new_project(bool skip_confirm = false, bool silent = false, const wxString& project_name = wxString(), bool reload_presets = true,
|
||||
bool tell_plugins = false);
|
||||
// Prompts::Skip starts it without the question about the unsaved project and modified presets. `silent` leaves
|
||||
// the shown tab as it is and sends plugins no NewProject event, for a reset that clears the way for another
|
||||
// project rather than starting one.
|
||||
int new_project(Ops::Prompts prompts = Ops::Prompts::Ask, bool silent = false, const wxString& project_name = wxString(),
|
||||
bool reload_presets = true);
|
||||
// BBS: save & backup
|
||||
void load_project(wxString const & filename = "", wxString const & originfile = "-");
|
||||
// `path` saves there without asking (automation); empty keeps the interactive behaviour.
|
||||
@@ -471,21 +472,21 @@ public:
|
||||
// toolpath geometry at load time. Keeps the current layer range and only-gcode mode.
|
||||
|
||||
// SoftFever
|
||||
// Each test starts a new project; `skip_confirm` skips its prompts (save the project, keep or
|
||||
// Each test starts a new project; Prompts::Skip skips its prompts (save the project, keep or
|
||||
// discard modified presets), keeping the modified presets, for a caller that has decided both.
|
||||
void calib_pa(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_pa(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
//ORCA: Add pattern parameter to calib_flowrate
|
||||
void calib_flowrate(bool is_linear, int pass, InfillPattern pattern = ipArchimedeanChords, int filament_id = 0, int extruder_id = 0,
|
||||
bool skip_confirm = false);
|
||||
Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
// True from calib_flowrate() until other files are loaded, like the print's calibration mode
|
||||
bool is_flowrate_calib() const;
|
||||
void calib_temp(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_max_vol_speed(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_retraction(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_VFA(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_input_shaping_freq(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_input_shaping_damp(const Calib_Params& params, bool skip_confirm = false);
|
||||
void Calib_Cornering(const Calib_Params& params, bool skip_confirm = false);
|
||||
void calib_temp(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
void calib_max_vol_speed(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
void calib_retraction(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
void calib_VFA(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
void calib_input_shaping_freq(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
void calib_input_shaping_damp(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
void Calib_Cornering(const Calib_Params& params, Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
|
||||
BuildVolume_Type get_build_volume_type() const;
|
||||
|
||||
@@ -908,9 +909,9 @@ public:
|
||||
enum class SplitResult { Split, OnePiece, Unanswered };
|
||||
// Splits object `obj_idx` into objects, as Split > To Objects does on the selected object, and selects them. Where
|
||||
// some of them would float above the bed of an object that drops, `keep_z` answers the question the split asks
|
||||
// (true keeps their height, as its Yes); with none it is asked when `ask`, and otherwise nothing is split. An object
|
||||
// of one piece is told in a message box when `ask`.
|
||||
SplitResult split_object(int obj_idx, bool ask, std::optional<bool> keep_z = std::nullopt);
|
||||
// (true keeps their height, as its Yes); with none it is asked with Prompts::Ask, and otherwise nothing is split. An
|
||||
// object of one piece is told in a message box with Prompts::Ask.
|
||||
SplitResult split_object(int obj_idx, Ops::Prompts prompts, std::optional<bool> keep_z = std::nullopt);
|
||||
void split_volume();
|
||||
void optimize_rotation();
|
||||
// find all empty cells on the plate and won't overlap with exclusion areas
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "libslic3r/LifecycleEvents.hpp"
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "slic3r/GUI/SettingsIndex.hpp"
|
||||
#include "slic3r/GUI/Operations/Outcome.hpp"
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
#include <wx/app.h>
|
||||
#include <wx/bookctrl.h>
|
||||
@@ -8495,8 +8496,9 @@ Tab::DeleteBlock Tab::can_delete_preset(const PresetCollection& presets, const P
|
||||
}
|
||||
|
||||
// Called for a currently selected preset.
|
||||
void Tab::delete_preset(bool ask)
|
||||
void Tab::delete_preset(Ops::Prompts prompts)
|
||||
{
|
||||
const bool ask = prompts == Ops::Prompts::Ask;
|
||||
auto current_preset = m_presets->get_selected_preset();
|
||||
// Don't let the user delete the ' - default - ' configuration.
|
||||
//BBS: add project embedded preset logic and refine is_external
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "ConfigManipulation.hpp"
|
||||
#include "OptionsGroup.hpp"
|
||||
#include "OptionStateRegistry.hpp"
|
||||
#include "Operations/Outcome.hpp"
|
||||
#include "libslic3r/Preset.hpp"
|
||||
//BBS: GUI refactor
|
||||
#include "Notebook.hpp"
|
||||
@@ -395,9 +396,9 @@ public:
|
||||
bool save_preset(std::string name = std::string(), bool detach = false, bool save_to_project = false, bool from_input = false, std::string input_name = "", bool plugin_warning_confirmed = false);
|
||||
//void save_preset(std::string name = std::string(), bool detach = false);
|
||||
|
||||
// Deletes the selected preset. `ask` false skips the confirmations, for a caller that has made the
|
||||
// Deletes the selected preset. Prompts::Skip skips the confirmations, for a caller that has made the
|
||||
// same checks itself; the refusal for a preset other presets inherit from still shows.
|
||||
void delete_preset(bool ask = true);
|
||||
void delete_preset(Ops::Prompts prompts = Ops::Prompts::Ask);
|
||||
// What keeps a preset from being deleted: a system (or default) preset and a preset of a bundle are
|
||||
// never deleted, and a base preset is not while other presets inherit from it.
|
||||
enum class DeleteBlock { None, System, FromBundle, InheritedFrom };
|
||||
|
||||
@@ -100,20 +100,21 @@ reply (`outcome`, `layers`) and then `sliced_flags()`.
|
||||
|
||||
**Scenario: a new project**
|
||||
|
||||
Each call is made from the Home tab (`view_set {tab: "home"}` first), so that `app_state.tab` shows the tab it leaves.
|
||||
New Project (the action) is `action_run {id: "new_project"}`.
|
||||
Each call is made from the Home tab (`view_set {tab: "home"}` first), so that `app_state.tab` shows the tab it leaves:
|
||||
a new project shows the Prepare tab whichever form starts it, a call with arguments as New Project does, and a refused
|
||||
call leaves the tab as it was. New Project (the action) is `action_run {id: "new_project"}`.
|
||||
|
||||
| # | Step | Project after | Also checked |
|
||||
|---|---|---|---|
|
||||
| 1 | New Project | `Untitled · none · clean` | the reply is not `blocked_by_dialog` and its `ran` is `orca_command:new_project:orca`; `dialogs()` empty; tab `prepare`; `undo_steps()` `["Reset Project", "New Project"]` |
|
||||
| 2 | `project_new {silent: true}` | `Untitled · none · clean` | reply `objects` 0, `names` `[]`, `plates` 1, no `discarded` or `modified`; tab `home`; `undo_steps()` `["Reset Project", "New Project"]` |
|
||||
| 2 | `project_new {silent: true}` | `Untitled · none · clean` | reply `objects` 0, `names` `[]`, `plates` 1, no `discarded` or `modified`; tab `prepare`; `undo_steps()` `["Reset Project", "New Project"]` |
|
||||
| 3 | cube `box` 20 at (128, 128), then `project_new {silent: true}` | `Untitled · none · dirty` | refused, `unsaved_changes`; `[box]` at (128, 128); tab `home` |
|
||||
| 4 | `project_new {discard_changes: true}` | `Untitled · none · clean` | reply `objects` 0; `[]`; tab `home` |
|
||||
| 4 | `project_new {discard_changes: true}` | `Untitled · none · clean` | reply `objects` 0; `[]`; tab `prepare` |
|
||||
| 5 | `settings_set {values: {top_shell_layers: 7}}` | `Untitled · none · dirty` | `values([top_shell_layers])` `7`; `unsaved("process")` `[top_shell_layers]` |
|
||||
| 6 | New Project | as after 5 | reply `blocked_by_dialog`; `dialogs()` is one dialog, titled `Creating a new project: unsaved changes`: a project with no objects asks nothing about saving it |
|
||||
| 7 | `dialog_answer` Discard; the job is followed to its end | `Untitled · none · clean` | `top_shell_layers` `4`; `unsaved("process")` `[]`; `dialogs()` empty; tab `prepare` |
|
||||
| 8 | `settings_set {values: {top_shell_layers: 7}}`, New Project, `dialog_answer` Transfer, the job followed to its end | `Untitled · none · clean` | the dialog of 6 opened; `top_shell_layers` `7`, `unsaved("process")` `[top_shell_layers]`: the change is carried into the new project; tab `prepare` |
|
||||
| 9 | `project_new {discard_changes: true, preset_changes: "discard"}` | `Untitled · none · clean` | reply `discarded` `{process: {name: "0.20mm Standard @MyKlipper", keys: ["top_shell_layers"]}}` and no `modified`; `top_shell_layers` `4`; `unsaved("process")` `[]`; tab `home` |
|
||||
| 9 | `project_new {discard_changes: true, preset_changes: "discard"}` | `Untitled · none · clean` | reply `discarded` `{process: {name: "0.20mm Standard @MyKlipper", keys: ["top_shell_layers"]}}` and no `modified`; `top_shell_layers` `4`; `unsaved("process")` `[]`; tab `prepare` |
|
||||
| 10 | `settings_set {values: {top_shell_layers: 7}}`, then `project_new {silent: true}` | `Untitled · none · dirty` | refused, `unsaved_changes`; `top_shell_layers` `7`; tab `home` |
|
||||
| 11 | `project_new {discard_changes: true}` | `Untitled · none · clean` | reply `modified` `{process: {name: "0.20mm Standard @MyKlipper", keys: ["top_shell_layers"]}}` and no `discarded`; `top_shell_layers` `7`, `unsaved("process")` `[top_shell_layers]`: the presets' changes carry over by default |
|
||||
|
||||
|
||||
@@ -311,7 +311,8 @@ and Wayland skips about a fifth of the test.
|
||||
**Tests:** `view_set`'s camera fields (`look_at`, `zoom`, `camera`, `orbit`) and the `camera_state` it returns,
|
||||
checked against `app_state.camera`. It covers four views: Prepare (including straight after `project_new`'s queued
|
||||
fit), Preview, the Design tab's own camera, and the assemble view's first showing. It also covers zoom clamping,
|
||||
`click_px_per_mm`, a fit after a resize on the Home tab, and a zoom given on Home while a fit is queued.
|
||||
`click_px_per_mm`, a fit after a resize on the Home tab, and a zoom given on Home while the fit `plate_add` queues
|
||||
waits for a 3D view to draw.
|
||||
|
||||
**Starts from:** `start(client)` on the Generic Klipper Printer 0.4 nozzle, which leaves the main window 1600×900 and
|
||||
the perspective projection; no check reads a preset, and nothing here is a Bambu Lab printer's own. Then a
|
||||
@@ -321,9 +322,9 @@ no test turns it on, and the app's default is off. The camera is the one the tes
|
||||
sets the camera it reads. The sweep launches the app with `--cad`.
|
||||
|
||||
**Leaves:** `use_perspective_camera` on; three canvas captures under `<datadir>/automation/out` (Prepare, assemble and
|
||||
Home; measured); an empty new project, from its last `project_new`, on the Prepare tab. For the rest of the app's run,
|
||||
which the next `start()` resets: the main window at 1400×800, from the resize on Home, and the auto-answer rule for
|
||||
the unsaved changes question. The window's size and the cameras are not stored.
|
||||
Home; measured); the imported cube and an empty second plate, added on Home, on the Prepare tab. For the rest of the
|
||||
app's run, which the next `start()` resets: the main window at 1400×800, from the resize on Home, and the
|
||||
auto-answer rule for the unsaved changes question. The window's size and the cameras are not stored.
|
||||
|
||||
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception.
|
||||
- Start: `start()` returns `{printer: KLIPPER, process: KLIPPER_STD, filaments: [GENERIC_PLA]}`.
|
||||
@@ -347,7 +348,7 @@ the unsaved changes question. The window's size and the cameras are not stored.
|
||||
- Back on Prepare, the zoom is 2. That value was set on Preview, so this shows the two share a camera.
|
||||
- Assemble: the call raises no error, and after a capture `app_state.camera` has zoom 4 and `look_at`
|
||||
[10, 20, 0].
|
||||
- Home:
|
||||
- Home, after `plate_add` there (Add Plate queues a fit of all plates and leaves the tab as it is):
|
||||
- `app_state` has no `camera`.
|
||||
- A zoom's reply has a `note`.
|
||||
- After switching to Prepare and a capture, the zoom is not 3.
|
||||
|
||||
@@ -242,7 +242,7 @@ class FilesTest:
|
||||
{k: reply.get(k) for k in ("objects", "names", "plates", "discarded", "modified")},
|
||||
{"objects": 0, "names": [], "plates": 1, "discarded": None, "modified": None})
|
||||
self.project_is(f"{s} 2", "Untitled", None, "clean")
|
||||
self.tab_is(f"{s} 2", "home")
|
||||
self.tab_is(f"{s} 2", "prepare")
|
||||
self.steps_are(f"{s} 2", ["Reset Project", "New Project"])
|
||||
|
||||
self.cube("box", 20, 128, 128)
|
||||
@@ -257,7 +257,7 @@ class FilesTest:
|
||||
self.t.equal(f"{s} 4: the reply's objects", reply.get("objects"), 0)
|
||||
self.project_is(f"{s} 4", "Untitled", None, "clean")
|
||||
self.names_are(f"{s} 4")
|
||||
self.tab_is(f"{s} 4", "home")
|
||||
self.tab_is(f"{s} 4", "prepare")
|
||||
|
||||
self.run("settings_set", values={"top_shell_layers": 7})
|
||||
self.project_is(f"{s} 5", "Untitled", None, "dirty")
|
||||
@@ -295,7 +295,7 @@ class FilesTest:
|
||||
self.project_is(f"{s} 9", "Untitled", None, "clean")
|
||||
self.values_are(f"{s} 9", {"top_shell_layers": "4"})
|
||||
self.unsaved_is(f"{s} 9", [])
|
||||
self.tab_is(f"{s} 9", "home")
|
||||
self.tab_is(f"{s} 9", "prepare")
|
||||
|
||||
self.run("settings_set", values={"top_shell_layers": 7})
|
||||
self.run("view_set", tab="home")
|
||||
|
||||
@@ -157,11 +157,11 @@ def main():
|
||||
check("resized on home: a fit on prepare uses the new size",
|
||||
zoom is not None and close(second.get("camera_state", {}).get("zoom"), zoom, 1e-3), (first, second))
|
||||
|
||||
# 10. On a tab with no 3D view, the fit project_new queues waits for the view to draw: app_state has no
|
||||
# 10. On a tab with no 3D view, the fit plate_add queues waits for the view to draw: app_state has no
|
||||
# camera, a zoom given then is applied with a note that the fit is still queued, and the fit replaces it
|
||||
# once the view draws.
|
||||
# once the view draws. Add Plate leaves the tab as it is, where a new project shows Prepare.
|
||||
view_set(tab="home")
|
||||
client.call("project_new", discard_changes=True)
|
||||
client.call("plate_add")
|
||||
state = client.call("app_state")
|
||||
check("home: app_state has no camera", "camera" not in state, state.get("camera"))
|
||||
reply = view_set(zoom=3)
|
||||
|
||||
Reference in new issue
Block a user