class 3D callbacks moved to c++
This commit is contained in:
parent
ff86407840
commit
a8500d6bae
@ -126,7 +126,8 @@ sub new {
|
||||
Slic3r::GUI::_3DScene::register_on_scale_object_uniformly_callback($self->{canvas3D}, sub { $self->changescale(undef) });
|
||||
Slic3r::GUI::_3DScene::register_on_increase_objects_callback($self->{canvas3D}, sub { $self->increase() });
|
||||
Slic3r::GUI::_3DScene::register_on_decrease_objects_callback($self->{canvas3D}, sub { $self->decrease() });
|
||||
Slic3r::GUI::_3DScene::register_on_remove_object_callback($self->{canvas3D}, sub { $self->remove() });
|
||||
Slic3r::GUI::_3DScene::register_on_remove_object_callback($self->{canvas3D}, sub { $self->remove() });
|
||||
Slic3r::GUI::_3DScene::register_on_instance_moved_callback($self->{canvas3D}, $on_instances_moved);
|
||||
# $self->{canvas3D}->set_on_double_click($on_double_click);
|
||||
# $self->{canvas3D}->set_on_right_click(sub { $on_right_click->($self->{canvas3D}, @_); });
|
||||
# $self->{canvas3D}->set_on_arrange(sub { $self->arrange });
|
||||
@ -136,21 +137,29 @@ sub new {
|
||||
# $self->{canvas3D}->set_on_increase_objects(sub { $self->increase() });
|
||||
# $self->{canvas3D}->set_on_decrease_objects(sub { $self->decrease() });
|
||||
# $self->{canvas3D}->set_on_remove_object(sub { $self->remove() });
|
||||
# $self->{canvas3D}->set_on_instances_moved($on_instances_moved);
|
||||
#==============================================================================================================================
|
||||
$self->{canvas3D}->set_on_instances_moved($on_instances_moved);
|
||||
$self->{canvas3D}->set_on_enable_action_buttons($enable_action_buttons);
|
||||
#===================================================================================================================================
|
||||
Slic3r::GUI::_3DScene::enable_shader($self->{canvas3D}, 1);
|
||||
Slic3r::GUI::_3DScene::enable_force_zoom_to_bed($self->{canvas3D}, 1);
|
||||
# $self->{canvas3D}->use_plain_shader(1);
|
||||
#===================================================================================================================================
|
||||
$self->{canvas3D}->set_on_wipe_tower_moved(sub {
|
||||
my ($new_pos_3f) = @_;
|
||||
Slic3r::GUI::_3DScene::register_on_wipe_tower_moved_callback($self->{canvas3D}, sub {
|
||||
my ($x, $y) = @_;
|
||||
my $cfg = Slic3r::Config->new;
|
||||
$cfg->set('wipe_tower_x', $new_pos_3f->x);
|
||||
$cfg->set('wipe_tower_y', $new_pos_3f->y);
|
||||
$cfg->set('wipe_tower_x', $x);
|
||||
$cfg->set('wipe_tower_y', $y);
|
||||
$self->GetFrame->{options_tabs}{print}->load_config($cfg);
|
||||
});
|
||||
|
||||
# $self->{canvas3D}->set_on_wipe_tower_moved(sub {
|
||||
# my ($new_pos_3f) = @_;
|
||||
# my $cfg = Slic3r::Config->new;
|
||||
# $cfg->set('wipe_tower_x', $new_pos_3f->x);
|
||||
# $cfg->set('wipe_tower_y', $new_pos_3f->y);
|
||||
# $self->GetFrame->{options_tabs}{print}->load_config($cfg);
|
||||
# });
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::register_on_model_update_callback($self->{canvas3D}, sub {
|
||||
if (wxTheApp->{app_config}->get("background_processing")) {
|
||||
|
@ -13,9 +13,7 @@ use base qw(Slic3r::GUI::3DScene Class::Accessor);
|
||||
use Wx::Locale gettext => 'L';
|
||||
|
||||
#==============================================================================================================================
|
||||
__PACKAGE__->mk_accessors(qw(
|
||||
on_rotate_object_left on_rotate_object_right on_scale_object_uniformly
|
||||
on_remove_object on_increase_objects on_decrease_objects on_enable_action_buttons));
|
||||
__PACKAGE__->mk_accessors(qw(on_enable_action_buttons));
|
||||
#__PACKAGE__->mk_accessors(qw(
|
||||
# on_arrange on_rotate_object_left on_rotate_object_right on_scale_object_uniformly
|
||||
# on_remove_object on_increase_objects on_decrease_objects on_enable_action_buttons));
|
||||
@ -44,12 +42,15 @@ sub new {
|
||||
#==============================================================================================================================
|
||||
$self->{config} = $config;
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_model($self, $model);
|
||||
Slic3r::GUI::_3DScene::set_print($self, $print);
|
||||
Slic3r::GUI::_3DScene::set_config($self, $config);
|
||||
#==============================================================================================================================
|
||||
$self->{on_select_object} = sub {};
|
||||
$self->{on_instances_moved} = sub {};
|
||||
$self->{on_wipe_tower_moved} = sub {};
|
||||
#==============================================================================================================================
|
||||
# $self->{on_instances_moved} = sub {};
|
||||
# $self->{on_wipe_tower_moved} = sub {};
|
||||
#==============================================================================================================================
|
||||
|
||||
$self->{objects_volumes_idxs} = [];
|
||||
|
||||
@ -64,44 +65,39 @@ sub new {
|
||||
# $self->{on_select_object}->(($volume_idx == -1) ? undef : $self->volumes->[$volume_idx]->object_idx)
|
||||
# if ($self->{on_select_object});
|
||||
# });
|
||||
#==============================================================================================================================
|
||||
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::register_on_move_callback($self, sub {
|
||||
#
|
||||
# $self->on_move(sub {
|
||||
#==============================================================================================================================
|
||||
my @volume_idxs = @_;
|
||||
my %done = (); # prevent moving instances twice
|
||||
my $object_moved;
|
||||
my $wipe_tower_moved;
|
||||
foreach my $volume_idx (@volume_idxs) {
|
||||
my $volume = $self->volumes->[$volume_idx];
|
||||
my $obj_idx = $volume->object_idx;
|
||||
my $instance_idx = $volume->instance_idx;
|
||||
next if $done{"${obj_idx}_${instance_idx}"};
|
||||
$done{"${obj_idx}_${instance_idx}"} = 1;
|
||||
if ($obj_idx < 1000) {
|
||||
# Move a regular object.
|
||||
my $model_object = $self->{model}->get_object($obj_idx);
|
||||
$model_object
|
||||
->instances->[$instance_idx]
|
||||
->offset
|
||||
->translate($volume->origin->x, $volume->origin->y); #))
|
||||
$model_object->invalidate_bounding_box;
|
||||
$object_moved = 1;
|
||||
} elsif ($obj_idx == 1000) {
|
||||
# Move a wipe tower proxy.
|
||||
$wipe_tower_moved = $volume->origin;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{on_instances_moved}->()
|
||||
if $object_moved && $self->{on_instances_moved};
|
||||
$self->{on_wipe_tower_moved}->($wipe_tower_moved)
|
||||
if $wipe_tower_moved && $self->{on_wipe_tower_moved};
|
||||
});
|
||||
|
||||
#==============================================================================================================================
|
||||
# my @volume_idxs = @_;
|
||||
# my %done = (); # prevent moving instances twice
|
||||
# my $object_moved;
|
||||
# my $wipe_tower_moved;
|
||||
# foreach my $volume_idx (@volume_idxs) {
|
||||
# my $volume = $self->volumes->[$volume_idx];
|
||||
# my $obj_idx = $volume->object_idx;
|
||||
# my $instance_idx = $volume->instance_idx;
|
||||
# next if $done{"${obj_idx}_${instance_idx}"};
|
||||
# $done{"${obj_idx}_${instance_idx}"} = 1;
|
||||
# if ($obj_idx < 1000) {
|
||||
# # Move a regular object.
|
||||
# my $model_object = $self->{model}->get_object($obj_idx);
|
||||
# $model_object
|
||||
# ->instances->[$instance_idx]
|
||||
# ->offset
|
||||
# ->translate($volume->origin->x, $volume->origin->y); #))
|
||||
# $model_object->invalidate_bounding_box;
|
||||
# $object_moved = 1;
|
||||
# } elsif ($obj_idx == 1000) {
|
||||
# # Move a wipe tower proxy.
|
||||
# $wipe_tower_moved = $volume->origin;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# $self->{on_instances_moved}->()
|
||||
# if $object_moved && $self->{on_instances_moved};
|
||||
# $self->{on_wipe_tower_moved}->($wipe_tower_moved)
|
||||
# if $wipe_tower_moved && $self->{on_wipe_tower_moved};
|
||||
# });
|
||||
#
|
||||
# EVT_KEY_DOWN($self, sub {
|
||||
# my ($s, $event) = @_;
|
||||
# if ($event->HasModifiers) {
|
||||
@ -194,19 +190,17 @@ sub set_on_select_object {
|
||||
# my ($self, $cb) = @_;
|
||||
# $self->on_remove_object($cb);
|
||||
#}
|
||||
#==============================================================================================================================
|
||||
|
||||
sub set_on_instances_moved {
|
||||
my ($self, $cb) = @_;
|
||||
$self->{on_instances_moved} = $cb;
|
||||
}
|
||||
|
||||
sub set_on_wipe_tower_moved {
|
||||
my ($self, $cb) = @_;
|
||||
$self->{on_wipe_tower_moved} = $cb;
|
||||
}
|
||||
|
||||
#==============================================================================================================================
|
||||
#
|
||||
#sub set_on_instances_moved {
|
||||
# my ($self, $cb) = @_;
|
||||
# $self->{on_instances_moved} = $cb;
|
||||
#}
|
||||
#
|
||||
#sub set_on_wipe_tower_moved {
|
||||
# my ($self, $cb) = @_;
|
||||
# $self->{on_wipe_tower_moved} = $cb;
|
||||
#}
|
||||
#
|
||||
#sub set_on_model_update {
|
||||
# my ($self, $cb) = @_;
|
||||
# $self->on_model_update($cb);
|
||||
@ -216,6 +210,9 @@ sub set_on_wipe_tower_moved {
|
||||
sub set_on_enable_action_buttons {
|
||||
my ($self, $cb) = @_;
|
||||
$self->on_enable_action_buttons($cb);
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::register_on_enable_action_buttons_callback($self, $cb);
|
||||
#==============================================================================================================================
|
||||
}
|
||||
|
||||
sub update_volumes_selection {
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
void call(int i) const;
|
||||
void call(int i, int j) const;
|
||||
void call(const std::vector<int>& ints) const;
|
||||
void call(double x, double y) const;
|
||||
// void call();
|
||||
// void call(int i);
|
||||
// void call(int i, int j);
|
||||
|
@ -266,6 +266,24 @@ void PerlCallback::call(const std::vector<int>& ints) const
|
||||
LEAVE;
|
||||
}
|
||||
|
||||
//##############################################################################################################
|
||||
void PerlCallback::call(double x, double y) const
|
||||
{
|
||||
if (!m_callback)
|
||||
return;
|
||||
dSP;
|
||||
ENTER;
|
||||
SAVETMPS;
|
||||
PUSHMARK(SP);
|
||||
XPUSHs(sv_2mortal(newSVnv(x)));
|
||||
XPUSHs(sv_2mortal(newSVnv(y)));
|
||||
PUTBACK;
|
||||
perl_call_sv(SvRV((SV*)m_callback), G_DISCARD);
|
||||
FREETMPS;
|
||||
LEAVE;
|
||||
}
|
||||
//##############################################################################################################
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
|
@ -1832,6 +1832,11 @@ void _3DScene::set_print(wxGLCanvas* canvas, Print* print)
|
||||
s_canvas_mgr.set_print(canvas, print);
|
||||
}
|
||||
|
||||
void _3DScene::set_model(wxGLCanvas* canvas, Model* model)
|
||||
{
|
||||
s_canvas_mgr.set_model(canvas, model);
|
||||
}
|
||||
|
||||
void _3DScene::set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape)
|
||||
{
|
||||
return s_canvas_mgr.set_bed_shape(canvas, shape);
|
||||
@ -1992,11 +1997,6 @@ void _3DScene::register_on_model_update_callback(wxGLCanvas* canvas, void* callb
|
||||
s_canvas_mgr.register_on_model_update_callback(canvas, callback);
|
||||
}
|
||||
|
||||
void _3DScene::register_on_move_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
s_canvas_mgr.register_on_move_callback(canvas, callback);
|
||||
}
|
||||
|
||||
void _3DScene::register_on_remove_object_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
s_canvas_mgr.register_on_remove_object_callback(canvas, callback);
|
||||
@ -2032,6 +2032,21 @@ void _3DScene::register_on_decrease_objects_callback(wxGLCanvas* canvas, void* c
|
||||
s_canvas_mgr.register_on_decrease_objects_callback(canvas, callback);
|
||||
}
|
||||
|
||||
void _3DScene::register_on_instance_moved_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
s_canvas_mgr.register_on_instance_moved_callback(canvas, callback);
|
||||
}
|
||||
|
||||
void _3DScene::register_on_wipe_tower_moved_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
s_canvas_mgr.register_on_wipe_tower_moved_callback(canvas, callback);
|
||||
}
|
||||
|
||||
void _3DScene::register_on_enable_action_buttons_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
s_canvas_mgr.register_on_enable_action_buttons_callback(canvas, callback);
|
||||
}
|
||||
|
||||
//void _3DScene::_glew_init()
|
||||
//{
|
||||
// glewInit();
|
||||
|
@ -565,6 +565,7 @@ public:
|
||||
|
||||
static void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
|
||||
static void set_print(wxGLCanvas* canvas, Print* print);
|
||||
static void set_model(wxGLCanvas* canvas, Model* model);
|
||||
|
||||
static void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
||||
static void set_auto_bed_shape(wxGLCanvas* canvas);
|
||||
@ -609,7 +610,6 @@ public:
|
||||
static void register_on_right_click_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_select_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_model_update_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_move_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_remove_object_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_arrange_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_rotate_object_left_callback(wxGLCanvas* canvas, void* callback);
|
||||
@ -617,6 +617,9 @@ public:
|
||||
static void register_on_scale_object_uniformly_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_increase_objects_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_decrease_objects_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_instance_moved_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_wipe_tower_moved_callback(wxGLCanvas* canvas, void* callback);
|
||||
static void register_on_enable_action_buttons_callback(wxGLCanvas* canvas, void* callback);
|
||||
|
||||
// static void _glew_init();
|
||||
//##################################################################################################################
|
||||
|
@ -947,6 +947,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
||||
, m_volumes(nullptr)
|
||||
, m_config(nullptr)
|
||||
, m_print(nullptr)
|
||||
, m_model(nullptr)
|
||||
, m_dirty(true)
|
||||
, m_initialized(false)
|
||||
, m_use_VBOs(false)
|
||||
@ -1116,6 +1117,11 @@ void GLCanvas3D::set_print(Print* print)
|
||||
m_print = print;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_model(Model* model)
|
||||
{
|
||||
m_model = model;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_bed_shape(const Pointfs& shape)
|
||||
{
|
||||
m_bed.set_shape(shape);
|
||||
@ -1836,12 +1842,6 @@ void GLCanvas3D::register_on_model_update_callback(void* callback)
|
||||
m_on_model_update_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3D::register_on_move_callback(void* callback)
|
||||
{
|
||||
if (callback != nullptr)
|
||||
m_on_move_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3D::register_on_remove_object_callback(void* callback)
|
||||
{
|
||||
if (callback != nullptr)
|
||||
@ -1884,6 +1884,24 @@ void GLCanvas3D::register_on_decrease_objects_callback(void* callback)
|
||||
m_on_decrease_objects_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3D::register_on_instance_moved_callback(void* callback)
|
||||
{
|
||||
if (callback != nullptr)
|
||||
m_on_instance_moved_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3D::register_on_wipe_tower_moved_callback(void* callback)
|
||||
{
|
||||
if (callback != nullptr)
|
||||
m_on_wipe_tower_moved_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3D::register_on_enable_action_buttons_callback(void* callback)
|
||||
{
|
||||
if (callback != nullptr)
|
||||
m_on_enable_action_buttons_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3D::bind_event_handlers()
|
||||
{
|
||||
if (m_canvas != nullptr)
|
||||
@ -2283,7 +2301,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
}
|
||||
}
|
||||
|
||||
m_on_move_callback.call(volume_idxs);
|
||||
_on_move(volume_idxs);
|
||||
}
|
||||
|
||||
m_mouse.drag.volume_idx = -1;
|
||||
@ -2511,7 +2529,6 @@ void GLCanvas3D::_deregister_callbacks()
|
||||
m_on_right_click_callback.deregister_callback();
|
||||
m_on_select_callback.deregister_callback();
|
||||
m_on_model_update_callback.deregister_callback();
|
||||
m_on_move_callback.deregister_callback();
|
||||
m_on_remove_object_callback.deregister_callback();
|
||||
m_on_arrange_callback.deregister_callback();
|
||||
m_on_rotate_object_left_callback.deregister_callback();
|
||||
@ -2519,6 +2536,9 @@ void GLCanvas3D::_deregister_callbacks()
|
||||
m_on_scale_object_uniformly_callback.deregister_callback();
|
||||
m_on_increase_objects_callback.deregister_callback();
|
||||
m_on_decrease_objects_callback.deregister_callback();
|
||||
m_on_instance_moved_callback.deregister_callback();
|
||||
m_on_wipe_tower_moved_callback.deregister_callback();
|
||||
m_on_enable_action_buttons_callback.deregister_callback();
|
||||
}
|
||||
|
||||
void GLCanvas3D::_mark_volumes_for_layer_height() const
|
||||
@ -3543,6 +3563,48 @@ void GLCanvas3D::_update_gcode_volumes_visibility(const GCodePreviewData& previe
|
||||
}
|
||||
}
|
||||
|
||||
void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
|
||||
{
|
||||
if ((m_model == nullptr) || (m_volumes == nullptr))
|
||||
return;
|
||||
|
||||
std::set<std::string> done; // prevent moving instances twice
|
||||
bool object_moved = false;
|
||||
Pointf3 wipe_tower_origin(0.0, 0.0, 0.0);
|
||||
for (int volume_idx : volume_idxs)
|
||||
{
|
||||
GLVolume* volume = m_volumes->volumes[volume_idx];
|
||||
int obj_idx = volume->object_idx();
|
||||
int instance_idx = volume->instance_idx();
|
||||
|
||||
// prevent moving instances twice
|
||||
char done_id[64];
|
||||
::sprintf(done_id, "%d_%d", obj_idx, instance_idx);
|
||||
if (done.find(done_id) != done.end())
|
||||
continue;
|
||||
|
||||
done.insert(done_id);
|
||||
|
||||
if (obj_idx < 1000)
|
||||
{
|
||||
// Move a regular object.
|
||||
ModelObject* model_object = m_model->objects[obj_idx];
|
||||
model_object->instances[instance_idx]->offset.translate(volume->origin.x, volume->origin.y);
|
||||
model_object->invalidate_bounding_box();
|
||||
object_moved = true;
|
||||
}
|
||||
else if (obj_idx == 1000)
|
||||
// Move a wipe tower proxy.
|
||||
wipe_tower_origin = volume->origin;
|
||||
}
|
||||
|
||||
if (object_moved)
|
||||
m_on_instance_moved_callback.call();
|
||||
|
||||
if (wipe_tower_origin != Pointf3(0.0, 0.0, 0.0))
|
||||
m_on_wipe_tower_moved_callback.call(wipe_tower_origin.x, wipe_tower_origin.y);
|
||||
}
|
||||
|
||||
std::vector<float> GLCanvas3D::_parse_colors(const std::vector<std::string>& colors)
|
||||
{
|
||||
std::vector<float> output(colors.size() * 4, 1.0f);
|
||||
|
@ -330,6 +330,7 @@ private:
|
||||
GLVolumeCollection* m_volumes;
|
||||
DynamicPrintConfig* m_config;
|
||||
Print* m_print;
|
||||
Model* m_model;
|
||||
|
||||
bool m_dirty;
|
||||
bool m_initialized;
|
||||
@ -355,7 +356,6 @@ private:
|
||||
PerlCallback m_on_right_click_callback;
|
||||
PerlCallback m_on_select_callback;
|
||||
PerlCallback m_on_model_update_callback;
|
||||
PerlCallback m_on_move_callback;
|
||||
PerlCallback m_on_remove_object_callback;
|
||||
PerlCallback m_on_arrange_callback;
|
||||
PerlCallback m_on_rotate_object_left_callback;
|
||||
@ -363,6 +363,9 @@ private:
|
||||
PerlCallback m_on_scale_object_uniformly_callback;
|
||||
PerlCallback m_on_increase_objects_callback;
|
||||
PerlCallback m_on_decrease_objects_callback;
|
||||
PerlCallback m_on_instance_moved_callback;
|
||||
PerlCallback m_on_wipe_tower_moved_callback;
|
||||
PerlCallback m_on_enable_action_buttons_callback;
|
||||
|
||||
public:
|
||||
GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context);
|
||||
@ -381,6 +384,7 @@ public:
|
||||
|
||||
void set_config(DynamicPrintConfig* config);
|
||||
void set_print(Print* print);
|
||||
void set_model(Model* model);
|
||||
|
||||
// Set the bed shape to a single closed 2D polygon(array of two element arrays),
|
||||
// triangulate the bed and store the triangles into m_bed.m_triangles,
|
||||
@ -447,7 +451,6 @@ public:
|
||||
void register_on_right_click_callback(void* callback);
|
||||
void register_on_select_callback(void* callback);
|
||||
void register_on_model_update_callback(void* callback);
|
||||
void register_on_move_callback(void* callback);
|
||||
void register_on_remove_object_callback(void* callback);
|
||||
void register_on_arrange_callback(void* callback);
|
||||
void register_on_rotate_object_left_callback(void* callback);
|
||||
@ -455,6 +458,9 @@ public:
|
||||
void register_on_scale_object_uniformly_callback(void* callback);
|
||||
void register_on_increase_objects_callback(void* callback);
|
||||
void register_on_decrease_objects_callback(void* callback);
|
||||
void register_on_instance_moved_callback(void* callback);
|
||||
void register_on_wipe_tower_moved_callback(void* callback);
|
||||
void register_on_enable_action_buttons_callback(void* callback);
|
||||
|
||||
void bind_event_handlers();
|
||||
void unbind_event_handlers();
|
||||
@ -528,6 +534,8 @@ private:
|
||||
// sets gcode geometry visibility according to user selection
|
||||
void _update_gcode_volumes_visibility(const GCodePreviewData& preview_data);
|
||||
|
||||
void _on_move(const std::vector<int>& volume_idxs);
|
||||
|
||||
static std::vector<float> _parse_colors(const std::vector<std::string>& colors);
|
||||
};
|
||||
|
||||
|
@ -268,6 +268,13 @@ void GLCanvas3DManager::set_print(wxGLCanvas* canvas, Print* print)
|
||||
it->second->set_print(print);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_model(wxGLCanvas* canvas, Model* model)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_model(model);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
@ -543,13 +550,6 @@ void GLCanvas3DManager::register_on_model_update_callback(wxGLCanvas* canvas, vo
|
||||
it->second->register_on_model_update_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::register_on_move_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->register_on_move_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::register_on_remove_object_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
@ -599,6 +599,27 @@ void GLCanvas3DManager::register_on_decrease_objects_callback(wxGLCanvas* canvas
|
||||
it->second->register_on_decrease_objects_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::register_on_instance_moved_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->register_on_instance_moved_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::register_on_wipe_tower_moved_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->register_on_wipe_tower_moved_callback(callback);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::register_on_enable_action_buttons_callback(wxGLCanvas* canvas, void* callback)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->register_on_enable_action_buttons_callback(callback);
|
||||
}
|
||||
|
||||
GLCanvas3DManager::CanvasesMap::iterator GLCanvas3DManager::_get_canvas(wxGLCanvas* canvas)
|
||||
{
|
||||
return (canvas == nullptr) ? m_canvases.end() : m_canvases.find(canvas);
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
|
||||
void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
|
||||
void set_print(wxGLCanvas* canvas, Print* print);
|
||||
void set_model(wxGLCanvas* canvas, Model* model);
|
||||
|
||||
void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
||||
void set_auto_bed_shape(wxGLCanvas* canvas);
|
||||
@ -112,7 +113,6 @@ public:
|
||||
void register_on_right_click_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_select_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_model_update_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_move_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_remove_object_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_arrange_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_rotate_object_left_callback(wxGLCanvas* canvas, void* callback);
|
||||
@ -120,6 +120,9 @@ public:
|
||||
void register_on_scale_object_uniformly_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_increase_objects_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_decrease_objects_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_instance_moved_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_wipe_tower_moved_callback(wxGLCanvas* canvas, void* callback);
|
||||
void register_on_enable_action_buttons_callback(wxGLCanvas* canvas, void* callback);
|
||||
|
||||
private:
|
||||
CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas);
|
||||
|
@ -239,6 +239,13 @@ set_print(canvas, print)
|
||||
CODE:
|
||||
_3DScene::set_print((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), print);
|
||||
|
||||
void
|
||||
set_model(canvas, model)
|
||||
SV *canvas;
|
||||
Model *model;
|
||||
CODE:
|
||||
_3DScene::set_model((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), model);
|
||||
|
||||
void
|
||||
set_bed_shape(canvas, shape)
|
||||
SV *canvas;
|
||||
@ -466,13 +473,6 @@ register_on_model_update_callback(canvas, callback)
|
||||
CODE:
|
||||
_3DScene::register_on_model_update_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||
|
||||
void
|
||||
register_on_move_callback(canvas, callback)
|
||||
SV *canvas;
|
||||
SV *callback;
|
||||
CODE:
|
||||
_3DScene::register_on_move_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||
|
||||
void
|
||||
register_on_remove_object_callback(canvas, callback)
|
||||
SV *canvas;
|
||||
@ -522,6 +522,27 @@ register_on_decrease_objects_callback(canvas, callback)
|
||||
CODE:
|
||||
_3DScene::register_on_decrease_objects_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||
|
||||
void
|
||||
register_on_instance_moved_callback(canvas, callback)
|
||||
SV *canvas;
|
||||
SV *callback;
|
||||
CODE:
|
||||
_3DScene::register_on_instance_moved_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||
|
||||
void
|
||||
register_on_wipe_tower_moved_callback(canvas, callback)
|
||||
SV *canvas;
|
||||
SV *callback;
|
||||
CODE:
|
||||
_3DScene::register_on_wipe_tower_moved_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||
|
||||
void
|
||||
register_on_enable_action_buttons_callback(canvas, callback)
|
||||
SV *canvas;
|
||||
SV *callback;
|
||||
CODE:
|
||||
_3DScene::register_on_enable_action_buttons_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||
|
||||
unsigned int
|
||||
finalize_legend_texture()
|
||||
CODE:
|
||||
|
Loading…
Reference in New Issue
Block a user