mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-09 19:11:48 +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.volume_name = create_volume_name();
|
||||
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);
|
||||
return true;
|
||||
|
||||
|
@ -91,8 +91,8 @@ void EmbossJob::finalize() {
|
||||
plater->take_snapshot(_L("Emboss text") + ": " + name);
|
||||
ModelVolume *volume = m_data->volume_ptr;
|
||||
if (volume == nullptr) {
|
||||
// decide to add as volume or new object
|
||||
if (m_data->object_ptr == nullptr) {
|
||||
// decide to add as volume or new object
|
||||
if (m_data->object_idx < 0) {
|
||||
// create new object
|
||||
app.obj_list()->load_mesh_object(tm, name, true, &m_data->text_configuration);
|
||||
app.mainframe->update_title();
|
||||
@ -106,8 +106,9 @@ void EmbossJob::finalize() {
|
||||
return;
|
||||
} else {
|
||||
// create new volume inside of object
|
||||
ModelObject *obj = m_data->object_ptr;
|
||||
volume = obj->add_volume(std::move(tm));
|
||||
Model & model = wxGetApp().plater()->model();
|
||||
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
|
||||
volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||
@ -134,9 +135,6 @@ void EmbossJob::finalize() {
|
||||
|
||||
// Job promiss to refresh is not working
|
||||
canvas->reload_scene(true);
|
||||
|
||||
// set data to model
|
||||
Job::finalize();
|
||||
}
|
||||
|
||||
void EmbossJob::select_volume(ModelVolume *volume)
|
||||
|
@ -22,13 +22,16 @@ class EmbossJob : protected Job
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
// Pointer on Data of font(glyoh shapes)
|
||||
std::shared_ptr<Emboss::Font> font;
|
||||
// font item is not used for create object
|
||||
TextConfiguration text_configuration;
|
||||
// new volume name created from text
|
||||
std::string volume_name;
|
||||
// when nulltrp new volume will be created
|
||||
// when volume_ptr == nullptr than new volume will be created
|
||||
ModelVolume *volume_ptr;
|
||||
// when nullptr volume is created in new object
|
||||
ModelObject *object_ptr;
|
||||
// when volume_ptr == nullptr && object_idx < 0 than new object will be created
|
||||
int object_idx;
|
||||
};
|
||||
EmbossJob();
|
||||
void restart(const Data &data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user