mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 02:49:04 +08:00
Inform user about not allowed use surface
This commit is contained in:
parent
7c1a513e5a
commit
871fde4bac
@ -177,6 +177,10 @@ namespace priv {
|
|||||||
/// <returns>Base data for emboss text</returns>
|
/// <returns>Base data for emboss text</returns>
|
||||||
static DataBase create_emboss_data_base(const std::string &text, StyleManager &style_manager);
|
static DataBase create_emboss_data_base(const std::string &text, StyleManager &style_manager);
|
||||||
|
|
||||||
|
static void message_disable_cut_surface(){
|
||||||
|
wxMessageBox(_L("Can NOT cut surface from nothing. Function 'use surface' was disabled for this text."),
|
||||||
|
_L("Disable 'use surface' from style"), wxOK | wxICON_WARNING);}
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
|
||||||
void GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d& mouse_pos)
|
void GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d& mouse_pos)
|
||||||
@ -207,7 +211,11 @@ void GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d& mous
|
|||||||
FontProp& prop = emboss_data.text_configuration.style.prop;
|
FontProp& prop = emboss_data.text_configuration.style.prop;
|
||||||
|
|
||||||
// can't create new object with using surface
|
// can't create new object with using surface
|
||||||
if (prop.use_surface) prop.use_surface = false;
|
if (prop.use_surface) {
|
||||||
|
priv::message_disable_cut_surface();
|
||||||
|
prop.use_surface = false;
|
||||||
|
}
|
||||||
|
|
||||||
// can't create new object with distance from surface
|
// can't create new object with distance from surface
|
||||||
if (prop.distance.has_value()) prop.distance.reset();
|
if (prop.distance.has_value()) prop.distance.reset();
|
||||||
|
|
||||||
@ -875,23 +883,27 @@ bool GLGizmoEmboss::start_volume_creation(ModelVolumeType volume_type, const Vec
|
|||||||
apply_transformation(font_prop, surface_trmat);
|
apply_transformation(font_prop, surface_trmat);
|
||||||
Transform3d volume_trmat = hit_instance_trmat.inverse() * hit_object_trmat * surface_trmat;
|
Transform3d volume_trmat = hit_instance_trmat.inverse() * hit_object_trmat * surface_trmat;
|
||||||
|
|
||||||
|
bool &use_surface = emboss_data.text_configuration.style.prop.use_surface;
|
||||||
std::unique_ptr<GUI::Job> job;
|
std::unique_ptr<GUI::Job> job;
|
||||||
if (!emboss_data.text_configuration.style.prop.use_surface) {
|
if (use_surface) {
|
||||||
// create volume
|
|
||||||
DataCreateVolume data{std::move(emboss_data), volume_type, object_idx_signed, volume_trmat};
|
|
||||||
job = std::make_unique<CreateVolumeJob>(std::move(data));
|
|
||||||
} else {
|
|
||||||
// Model to cut surface from.
|
// Model to cut surface from.
|
||||||
SurfaceVolumeData::ModelSources sources = create_sources(obj->volumes);
|
SurfaceVolumeData::ModelSources sources = create_sources(obj->volumes);
|
||||||
if (sources.empty()) return false;
|
if (sources.empty()) {
|
||||||
|
priv::message_disable_cut_surface();
|
||||||
bool is_outside = volume_type == ModelVolumeType::MODEL_PART;
|
use_surface = false;
|
||||||
// check that there is not unexpected volume type
|
} else {
|
||||||
assert(is_outside ||
|
bool is_outside = volume_type == ModelVolumeType::MODEL_PART;
|
||||||
volume_type == ModelVolumeType::NEGATIVE_VOLUME ||
|
// check that there is not unexpected volume type
|
||||||
volume_type == ModelVolumeType::PARAMETER_MODIFIER);
|
assert(is_outside || volume_type == ModelVolumeType::NEGATIVE_VOLUME || volume_type == ModelVolumeType::PARAMETER_MODIFIER);
|
||||||
CreateSurfaceVolumeData surface_data{std::move(emboss_data), volume_trmat, is_outside, std::move(sources), volume_type, object_idx_signed};
|
CreateSurfaceVolumeData surface_data{std::move(emboss_data), volume_trmat, is_outside,
|
||||||
job = std::make_unique<CreateSurfaceVolumeJob>(std::move(surface_data));
|
std::move(sources), volume_type, object_idx_signed};
|
||||||
|
job = std::make_unique<CreateSurfaceVolumeJob>(std::move(surface_data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!use_surface) {
|
||||||
|
// create volume
|
||||||
|
DataCreateVolume data{std::move(emboss_data), volume_type, object_idx_signed, volume_trmat};
|
||||||
|
job = std::make_unique<CreateVolumeJob>(std::move(data));
|
||||||
}
|
}
|
||||||
Worker &worker = plater->get_ui_job_worker();
|
Worker &worker = plater->get_ui_job_worker();
|
||||||
queue_job(worker, std::move(job));
|
queue_job(worker, std::move(job));
|
||||||
@ -996,8 +1008,15 @@ bool GLGizmoEmboss::process()
|
|||||||
std::unique_ptr<Job> job = nullptr;
|
std::unique_ptr<Job> job = nullptr;
|
||||||
|
|
||||||
// check cutting from source mesh
|
// check cutting from source mesh
|
||||||
const TextConfiguration &tc = data.text_configuration;
|
bool &use_surface = data.text_configuration.style.prop.use_surface;
|
||||||
if (tc.style.prop.use_surface) {
|
bool is_object = m_volume->get_object()->volumes.size() == 1;
|
||||||
|
if (use_surface && is_object) {
|
||||||
|
priv::message_disable_cut_surface();
|
||||||
|
use_surface = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (use_surface) {
|
||||||
// Model to cut surface from.
|
// Model to cut surface from.
|
||||||
SurfaceVolumeData::ModelSources sources = create_volume_sources(m_volume);
|
SurfaceVolumeData::ModelSources sources = create_volume_sources(m_volume);
|
||||||
if (sources.empty()) return false;
|
if (sources.empty()) return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user