mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 15:59:01 +08:00
Attempt to solve conflict with a3bd1b5 by adding id to PrintObject and using that as a hash key.
This commit is contained in:
parent
9247f21ff8
commit
19d18bdd84
@ -168,10 +168,11 @@ sub extrude_loop {
|
|||||||
if ($self->config->seal_position eq 'nearest') {
|
if ($self->config->seal_position eq 'nearest') {
|
||||||
$loop->split_at_vertex($last_pos->nearest_point(\@candidates));
|
$loop->split_at_vertex($last_pos->nearest_point(\@candidates));
|
||||||
} elsif ($self->config->seal_position eq 'aligned') {
|
} elsif ($self->config->seal_position eq 'aligned') {
|
||||||
if (defined $self->layer && defined $self->_seal_position->{$self->layer->object}) {
|
my $object_id = $self->layer->object->id;
|
||||||
$last_pos = $self->_seal_position->{$self->layer->object};
|
if (defined $self->layer && defined $self->_seal_position->{$object_id}) {
|
||||||
|
$last_pos = $self->_seal_position->{$object_id};
|
||||||
}
|
}
|
||||||
my $point = $self->_seal_position->{$self->layer->object} = $last_pos->nearest_point(\@candidates);
|
my $point = $self->_seal_position->{$object_id} = $last_pos->nearest_point(\@candidates);
|
||||||
$loop->split_at_vertex($point);
|
$loop->split_at_vertex($point);
|
||||||
}
|
}
|
||||||
} elsif ($self->config->seal_position eq 'random') {
|
} elsif ($self->config->seal_position eq 'random') {
|
||||||
|
@ -73,9 +73,10 @@ REGISTER_CLASS(PrintRegion, "Print::Region");
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
PrintObject::PrintObject(Print* print, ModelObject* model_object,
|
PrintObject::PrintObject(Print* print, int id, ModelObject* model_object,
|
||||||
const BoundingBoxf3 &modobj_bbox)
|
const BoundingBoxf3 &modobj_bbox)
|
||||||
: _print(print),
|
: _print(print),
|
||||||
|
_id(id),
|
||||||
_model_object(model_object)
|
_model_object(model_object)
|
||||||
{
|
{
|
||||||
region_volumes.resize(this->_print->regions.size());
|
region_volumes.resize(this->_print->regions.size());
|
||||||
@ -109,6 +110,12 @@ PrintObject::print()
|
|||||||
return this->_print;
|
return this->_print;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
PrintObject::id()
|
||||||
|
{
|
||||||
|
return this->_id;
|
||||||
|
}
|
||||||
|
|
||||||
ModelObject*
|
ModelObject*
|
||||||
PrintObject::model_object()
|
PrintObject::model_object()
|
||||||
{
|
{
|
||||||
@ -239,7 +246,8 @@ PrintObject*
|
|||||||
Print::add_object(ModelObject *model_object,
|
Print::add_object(ModelObject *model_object,
|
||||||
const BoundingBoxf3 &modobj_bbox)
|
const BoundingBoxf3 &modobj_bbox)
|
||||||
{
|
{
|
||||||
PrintObject *object = new PrintObject(this, model_object, modobj_bbox);
|
PrintObject *object = new PrintObject(this,
|
||||||
|
this->objects.size(), model_object, modobj_bbox);
|
||||||
objects.push_back(object);
|
objects.push_back(object);
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -253,7 +261,7 @@ Print::set_new_object(size_t idx, ModelObject *model_object,
|
|||||||
PrintObjectPtrs::iterator old_it = this->objects.begin() + idx;
|
PrintObjectPtrs::iterator old_it = this->objects.begin() + idx;
|
||||||
delete *old_it;
|
delete *old_it;
|
||||||
|
|
||||||
PrintObject *object = new PrintObject(this, model_object, modobj_bbox);
|
PrintObject *object = new PrintObject(this, idx, model_object, modobj_bbox);
|
||||||
this->objects[idx] = object;
|
this->objects[idx] = object;
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,7 @@ class PrintObject
|
|||||||
|
|
||||||
|
|
||||||
Print* print();
|
Print* print();
|
||||||
|
int id();
|
||||||
ModelObject* model_object();
|
ModelObject* model_object();
|
||||||
|
|
||||||
// adds region_id, too, if necessary
|
// adds region_id, too, if necessary
|
||||||
@ -111,11 +112,12 @@ class PrintObject
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Print* _print;
|
Print* _print;
|
||||||
|
int _id;
|
||||||
ModelObject* _model_object;
|
ModelObject* _model_object;
|
||||||
|
|
||||||
// TODO: call model_object->get_bounding_box() instead of accepting
|
// TODO: call model_object->get_bounding_box() instead of accepting
|
||||||
// parameter
|
// parameter
|
||||||
PrintObject(Print* print, ModelObject* model_object,
|
PrintObject(Print* print, int id, ModelObject* model_object,
|
||||||
const BoundingBoxf3 &modobj_bbox);
|
const BoundingBoxf3 &modobj_bbox);
|
||||||
virtual ~PrintObject();
|
virtual ~PrintObject();
|
||||||
};
|
};
|
||||||
|
@ -66,6 +66,7 @@ _constant()
|
|||||||
%code%{ RETVAL = THIS->print()->regions.size(); %};
|
%code%{ RETVAL = THIS->print()->regions.size(); %};
|
||||||
|
|
||||||
Ref<Print> print();
|
Ref<Print> print();
|
||||||
|
int id();
|
||||||
Ref<ModelObject> model_object();
|
Ref<ModelObject> model_object();
|
||||||
Ref<PrintObjectConfig> config()
|
Ref<PrintObjectConfig> config()
|
||||||
%code%{ RETVAL = &THIS->config; %};
|
%code%{ RETVAL = &THIS->config; %};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user