mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 19:28:14 -06:00
3DScene update_volumes_colors_by_extruder method moved to c++
This commit is contained in:
parent
5ee5465f94
commit
df14a3c399
11 changed files with 64 additions and 22 deletions
|
@ -1985,13 +1985,13 @@ sub Render {
|
|||
# }
|
||||
# }
|
||||
#}
|
||||
#
|
||||
#sub update_volumes_colors_by_extruder {
|
||||
# my ($self, $config) = @_;
|
||||
# $self->volumes->update_colors_by_extruder($config);
|
||||
#}
|
||||
#==============================================================================================================================
|
||||
|
||||
sub update_volumes_colors_by_extruder {
|
||||
my ($self, $config) = @_;
|
||||
$self->volumes->update_colors_by_extruder($config);
|
||||
}
|
||||
|
||||
sub opengl_info
|
||||
{
|
||||
my ($self, %params) = @_;
|
||||
|
|
|
@ -245,7 +245,10 @@ sub reload_scene {
|
|||
}
|
||||
}
|
||||
|
||||
$self->update_volumes_colors_by_extruder($self->{config});
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::update_volumes_colors_by_extruder($self);
|
||||
# $self->update_volumes_colors_by_extruder($self->{config});
|
||||
#==============================================================================================================================
|
||||
|
||||
# checks for geometry outside the print volume to render it accordingly
|
||||
if (scalar @{$self->volumes} > 0)
|
||||
|
|
|
@ -119,12 +119,14 @@ sub new {
|
|||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_auto_bed_shape($canvas);
|
||||
Slic3r::GUI::_3DScene::set_axes_length($canvas, 2.0 * max(@{ Slic3r::GUI::_3DScene::get_volumes_bounding_box($canvas)->size }));
|
||||
# Slic3r::GUI::_3DScene::set_axes_length($canvas, 2.0 * max(@{ $canvas->volumes_bounding_box->size }));
|
||||
|
||||
# $canvas->set_auto_bed_shape;
|
||||
#==============================================================================================================================
|
||||
$canvas->SetSize([500,500]);
|
||||
$canvas->SetMinSize($canvas->GetSize);
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_config($canvas, $self->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
}
|
||||
|
||||
$self->{sizer} = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||
|
@ -264,12 +266,13 @@ sub _update {
|
|||
$self->{canvas}->load_object($_, undef, undef, [0]) for @objects;
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_cutting_plane($self->{canvas}, $self->{cut_options}{z}, [@expolygons]);
|
||||
Slic3r::GUI::_3DScene::update_volumes_colors_by_extruder($self->{canvas});
|
||||
# $self->{canvas}->SetCuttingPlane(
|
||||
# $self->{cut_options}{z},
|
||||
# [@expolygons],
|
||||
# );
|
||||
# $self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
$self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->{config});
|
||||
$self->{canvas}->Render;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,12 +169,15 @@ sub new {
|
|||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_auto_bed_shape($canvas);
|
||||
Slic3r::GUI::_3DScene::set_axes_length($canvas, 2.0 * max(@{ Slic3r::GUI::_3DScene::get_volumes_bounding_box($canvas)->size }));
|
||||
# Slic3r::GUI::_3DScene::set_axes_length($canvas, 2.0 * max(@{ $canvas->volumes_bounding_box->size }));
|
||||
|
||||
# $canvas->set_auto_bed_shape;
|
||||
#==============================================================================================================================
|
||||
$canvas->SetSize([500,700]);
|
||||
$canvas->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_config($canvas, $self->GetParent->GetParent->GetParent->{config});
|
||||
Slic3r::GUI::_3DScene::update_volumes_colors_by_extruder($canvas);
|
||||
# $canvas->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
}
|
||||
|
||||
$self->{sizer} = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||
|
@ -506,9 +509,10 @@ sub _parts_changed {
|
|||
$self->{canvas}->load_object($self->{model_object});
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::zoom_to_volumes($self->{canvas});
|
||||
Slic3r::GUI::_3DScene::update_volumes_colors_by_extruder($self->{canvas});
|
||||
# $self->{canvas}->zoom_to_volumes;
|
||||
# $self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
$self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
$self->{canvas}->Render;
|
||||
}
|
||||
}
|
||||
|
@ -563,7 +567,10 @@ sub _update_canvas {
|
|||
}
|
||||
}
|
||||
|
||||
$self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::update_volumes_colors_by_extruder($self->{canvas});
|
||||
# $self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
$self->{canvas}->Render;
|
||||
}
|
||||
}
|
||||
|
@ -591,7 +598,10 @@ sub _update {
|
|||
# $self->{canvas}->reset_objects;
|
||||
#==============================================================================================================================
|
||||
$self->{canvas}->load_object($_, undef, [0]) for @objects;
|
||||
$self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::update_volumes_colors_by_extruder($self->{canvas});
|
||||
# $self->{canvas}->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
|
||||
#==============================================================================================================================
|
||||
$self->{canvas}->Render;
|
||||
}
|
||||
|
||||
|
|
|
@ -2105,6 +2105,11 @@ void _3DScene::select_view(wxGLCanvas* canvas, const std::string& direction)
|
|||
s_canvas_mgr.select_view(canvas, direction);
|
||||
}
|
||||
|
||||
void _3DScene::update_volumes_colors_by_extruder(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.update_volumes_colors_by_extruder(canvas);
|
||||
}
|
||||
|
||||
bool _3DScene::start_using_shader(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.start_using_shader(canvas);
|
||||
|
|
|
@ -645,13 +645,13 @@ public:
|
|||
static void zoom_to_volumes(wxGLCanvas* canvas);
|
||||
static void select_view(wxGLCanvas* canvas, const std::string& direction);
|
||||
|
||||
static void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
||||
|
||||
static bool start_using_shader(wxGLCanvas* canvas);
|
||||
static void stop_using_shader(wxGLCanvas* canvas);
|
||||
|
||||
static void render(wxGLCanvas* canvas);
|
||||
|
||||
static void render_volumes(wxGLCanvas* canvas, bool fake_colors);
|
||||
|
||||
static void render_texture(wxGLCanvas* canvas, unsigned int tex_id, float left, float right, float bottom, float top);
|
||||
|
||||
static void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
||||
|
|
|
@ -1520,6 +1520,14 @@ void GLCanvas3D::select_view(const std::string& direction)
|
|||
}
|
||||
}
|
||||
|
||||
void GLCanvas3D::update_volumes_colors_by_extruder()
|
||||
{
|
||||
if ((m_volumes == nullptr) || (m_config == nullptr))
|
||||
return;
|
||||
|
||||
m_volumes->update_colors_by_extruder(m_config);
|
||||
}
|
||||
|
||||
bool GLCanvas3D::start_using_shader() const
|
||||
{
|
||||
return m_shader.start_using();
|
||||
|
|
|
@ -428,13 +428,13 @@ public:
|
|||
void zoom_to_volumes();
|
||||
void select_view(const std::string& direction);
|
||||
|
||||
void update_volumes_colors_by_extruder();
|
||||
|
||||
bool start_using_shader() const;
|
||||
void stop_using_shader() const;
|
||||
|
||||
void render(bool useVBOs) const;
|
||||
|
||||
void render_volumes(bool fake_colors) const;
|
||||
|
||||
void render_texture(unsigned int tex_id, float left, float right, float bottom, float top) const;
|
||||
|
||||
void register_on_viewport_changed_callback(void* callback);
|
||||
|
|
|
@ -597,6 +597,13 @@ void GLCanvas3DManager::select_view(wxGLCanvas* canvas, const std::string& direc
|
|||
it->second->select_view(direction);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::update_volumes_colors_by_extruder(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->update_volumes_colors_by_extruder();
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::start_using_shader(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
|
|
|
@ -145,13 +145,13 @@ public:
|
|||
void zoom_to_volumes(wxGLCanvas* canvas);
|
||||
void select_view(wxGLCanvas* canvas, const std::string& direction);
|
||||
|
||||
void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
||||
|
||||
bool start_using_shader(wxGLCanvas* canvas) const;
|
||||
void stop_using_shader(wxGLCanvas* canvas) const;
|
||||
|
||||
void render(wxGLCanvas* canvas) const;
|
||||
|
||||
void render_volumes(wxGLCanvas* canvas, bool fake_colors) const;
|
||||
|
||||
void render_texture(wxGLCanvas* canvas, unsigned int tex_id, float left, float right, float bottom, float top) const;
|
||||
|
||||
void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
||||
|
|
|
@ -717,6 +717,12 @@ select_view(canvas, direction)
|
|||
CODE:
|
||||
_3DScene::select_view((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), direction);
|
||||
|
||||
void
|
||||
update_volumes_colors_by_extruder(canvas)
|
||||
SV *canvas;
|
||||
CODE:
|
||||
_3DScene::update_volumes_colors_by_extruder((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
|
||||
bool
|
||||
start_using_shader(canvas)
|
||||
SV *canvas;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue