Fix of changing the order of volumes of a multi-volume part:

The 3D preview scene was not updated properly.
This commit is contained in:
bubnikv 2017-06-21 14:10:22 +02:00
parent 7ca02bda0f
commit b12e4689e8
2 changed files with 20 additions and 0 deletions

View File

@ -421,6 +421,7 @@ sub on_btn_move_up {
if ($itemData && $itemData->{type} eq 'volume') {
my $volume_id = $itemData->{volume_id};
if ($self->{model_object}->move_volume_up($volume_id)) {
$self->{canvas}->volumes->move_volume_up($volume_id);
$self->{parts_changed} = 1;
$self->reload_tree($volume_id - 1);
}
@ -433,6 +434,7 @@ sub on_btn_move_down {
if ($itemData && $itemData->{type} eq 'volume') {
my $volume_id = $itemData->{volume_id};
if ($self->{model_object}->move_volume_down($volume_id)) {
$self->{canvas}->volumes->move_volume_down($volume_id);
$self->{parts_changed} = 1;
$self->reload_tree($volume_id + 1);
}

View File

@ -90,6 +90,24 @@
void render_legacy() const;
void finalize_geometry(bool use_VBOs);
void release_geometry();
bool move_volume_up(int idx)
%code%{
if (idx > 0 && idx < int(THIS->volumes.size())) {
std::swap(THIS->volumes[idx-1], THIS->volumes[idx]);
RETVAL = true;
} else
RETVAL = false;
%};
bool move_volume_down(int idx)
%code%{
if (idx >= 0 && idx + 1 < int(THIS->volumes.size())) {
std::swap(THIS->volumes[idx+1], THIS->volumes[idx]);
RETVAL = true;
} else
RETVAL = false;
%};
%{
SV*