mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-10 03:51:49 +08:00
Fix Creation of the new text object
This commit is contained in:
parent
55d83e6238
commit
eaaa59be86
@ -474,13 +474,8 @@ bool GLGizmoEmboss::process()
|
|||||||
data.text_configuration = create_configuration();
|
data.text_configuration = create_configuration();
|
||||||
data.volume_name = create_volume_name();
|
data.volume_name = create_volume_name();
|
||||||
data.volume_ptr = m_volume;
|
data.volume_ptr = m_volume;
|
||||||
|
data.object_idx = m_parent.get_selection().get_object_idx();
|
||||||
|
|
||||||
const Selection &selection = m_parent.get_selection();
|
|
||||||
if (!selection.is_empty() && selection.get_object_idx() >= 0) {
|
|
||||||
int object_idx = selection.get_object_idx();
|
|
||||||
Model &model = wxGetApp().plater()->model();
|
|
||||||
data.object_ptr = model.objects[object_idx];
|
|
||||||
}
|
|
||||||
m_job->restart(data);
|
m_job->restart(data);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ void EmbossJob::finalize() {
|
|||||||
plater->take_snapshot(_L("Emboss text") + ": " + name);
|
plater->take_snapshot(_L("Emboss text") + ": " + name);
|
||||||
ModelVolume *volume = m_data->volume_ptr;
|
ModelVolume *volume = m_data->volume_ptr;
|
||||||
if (volume == nullptr) {
|
if (volume == nullptr) {
|
||||||
// decide to add as volume or new object
|
// decide to add as volume or new object
|
||||||
if (m_data->object_ptr == nullptr) {
|
if (m_data->object_idx < 0) {
|
||||||
// create new object
|
// create new object
|
||||||
app.obj_list()->load_mesh_object(tm, name, true, &m_data->text_configuration);
|
app.obj_list()->load_mesh_object(tm, name, true, &m_data->text_configuration);
|
||||||
app.mainframe->update_title();
|
app.mainframe->update_title();
|
||||||
@ -106,8 +106,9 @@ void EmbossJob::finalize() {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// create new volume inside of object
|
// create new volume inside of object
|
||||||
ModelObject *obj = m_data->object_ptr;
|
Model & model = wxGetApp().plater()->model();
|
||||||
volume = obj->add_volume(std::move(tm));
|
ModelObject *obj = model.objects[m_data->object_idx];
|
||||||
|
volume = obj->add_volume(std::move(tm));
|
||||||
|
|
||||||
// set a default extruder value, since user can't add it manually
|
// set a default extruder value, since user can't add it manually
|
||||||
volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||||
@ -134,9 +135,6 @@ void EmbossJob::finalize() {
|
|||||||
|
|
||||||
// Job promiss to refresh is not working
|
// Job promiss to refresh is not working
|
||||||
canvas->reload_scene(true);
|
canvas->reload_scene(true);
|
||||||
|
|
||||||
// set data to model
|
|
||||||
Job::finalize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmbossJob::select_volume(ModelVolume *volume)
|
void EmbossJob::select_volume(ModelVolume *volume)
|
||||||
|
@ -22,13 +22,16 @@ class EmbossJob : protected Job
|
|||||||
public:
|
public:
|
||||||
struct Data
|
struct Data
|
||||||
{
|
{
|
||||||
|
// Pointer on Data of font(glyoh shapes)
|
||||||
std::shared_ptr<Emboss::Font> font;
|
std::shared_ptr<Emboss::Font> font;
|
||||||
|
// font item is not used for create object
|
||||||
TextConfiguration text_configuration;
|
TextConfiguration text_configuration;
|
||||||
|
// new volume name created from text
|
||||||
std::string volume_name;
|
std::string volume_name;
|
||||||
// when nulltrp new volume will be created
|
// when volume_ptr == nullptr than new volume will be created
|
||||||
ModelVolume *volume_ptr;
|
ModelVolume *volume_ptr;
|
||||||
// when nullptr volume is created in new object
|
// when volume_ptr == nullptr && object_idx < 0 than new object will be created
|
||||||
ModelObject *object_ptr;
|
int object_idx;
|
||||||
};
|
};
|
||||||
EmbossJob();
|
EmbossJob();
|
||||||
void restart(const Data &data);
|
void restart(const Data &data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user