Use position loaded from .3mf
This commit is contained in:
parent
3332dfd8b0
commit
905d6f4be7
@ -178,7 +178,6 @@ void GLGizmoEmboss::initialize()
|
||||
|
||||
load_font_list();
|
||||
|
||||
|
||||
m_font_selected = 0;
|
||||
|
||||
bool is_font_loaded = load_font();
|
||||
@ -302,10 +301,15 @@ bool GLGizmoEmboss::add_volume(const std::string &name, indexed_triangle_set &it
|
||||
if (its.indices.empty()) return false;
|
||||
// add object
|
||||
TriangleMesh tm(std::move(its));
|
||||
// center triangle mesh
|
||||
Vec3d shift = tm.bounding_box().center();
|
||||
tm.translate(-shift.cast<float>());
|
||||
|
||||
GUI_App & app = wxGetApp();
|
||||
Plater * plater = app.plater();
|
||||
plater->take_snapshot(_L("Add") + " " + name);
|
||||
if (m_volume == nullptr) {
|
||||
// decide to add as volume or new object
|
||||
const Selection &selection = m_parent.get_selection();
|
||||
if (selection.is_empty()) {
|
||||
// create new object
|
||||
@ -320,6 +324,7 @@ bool GLGizmoEmboss::add_volume(const std::string &name, indexed_triangle_set &it
|
||||
GLGizmosManager::EType::Emboss);
|
||||
return true;
|
||||
} else {
|
||||
// create new volume inside of object
|
||||
Model & model = plater->model();
|
||||
int object_idx = selection.get_object_idx();
|
||||
ModelObject *obj = model.objects[object_idx];
|
||||
@ -328,9 +333,6 @@ bool GLGizmoEmboss::add_volume(const std::string &name, indexed_triangle_set &it
|
||||
} else {
|
||||
m_volume->set_mesh(std::move(tm));
|
||||
m_volume->set_new_unique_id();
|
||||
m_volume->translate(-m_volume->source.mesh_offset);
|
||||
|
||||
m_volume->center_geometry_after_creation(true);
|
||||
m_volume->calculate_convex_hull();
|
||||
m_volume->get_object()->invalidate_bounding_box();
|
||||
}
|
||||
@ -379,6 +381,7 @@ void GLGizmoEmboss::draw_window()
|
||||
if (!m_font.has_value()) {
|
||||
ImGui::Text(_L("Warning: No font is selected. Select correct one.").c_str());
|
||||
}
|
||||
if (ImGui::Button("process")) process();
|
||||
draw_font_list();
|
||||
|
||||
//ImGui::SameLine();
|
||||
|
Loading…
Reference in New Issue
Block a user