3DScene member variables moved to c++
This commit is contained in:
parent
2dee4d1a83
commit
e79037c44d
@ -2150,19 +2150,23 @@ use List::Util qw(first min max);
|
||||
use Slic3r::Geometry qw(scale unscale epsilon);
|
||||
use Slic3r::Print::State ':steps';
|
||||
|
||||
__PACKAGE__->mk_accessors(qw(
|
||||
color_by
|
||||
select_by
|
||||
drag_by
|
||||
));
|
||||
#===================================================================================================================================
|
||||
#__PACKAGE__->mk_accessors(qw(
|
||||
# color_by
|
||||
# select_by
|
||||
# drag_by
|
||||
#));
|
||||
#===================================================================================================================================
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
||||
my $self = $class->SUPER::new(@_);
|
||||
$self->color_by('volume'); # object | volume
|
||||
$self->select_by('object'); # object | volume | instance
|
||||
$self->drag_by('instance'); # object | instance
|
||||
#===================================================================================================================================
|
||||
# $self->color_by('volume'); # object | volume
|
||||
# $self->select_by('object'); # object | volume | instance
|
||||
# $self->drag_by('instance'); # object | instance
|
||||
#===================================================================================================================================
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -22,11 +22,13 @@ sub new {
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::enable_picking($self, 1);
|
||||
Slic3r::GUI::_3DScene::enable_moving($self, 1);
|
||||
Slic3r::GUI::_3DScene::set_select_by($self, 'object');
|
||||
Slic3r::GUI::_3DScene::set_drag_by($self, 'instance');
|
||||
# $self->enable_picking(1);
|
||||
# $self->enable_moving(1);
|
||||
# $self->select_by('object');
|
||||
# $self->drag_by('instance');
|
||||
#==============================================================================================================================
|
||||
$self->select_by('object');
|
||||
$self->drag_by('instance');
|
||||
|
||||
$self->{objects} = $objects;
|
||||
$self->{model} = $model;
|
||||
|
@ -155,11 +155,7 @@ sub new {
|
||||
$canvas = $self->{canvas} = Slic3r::GUI::3DScene->new($self);
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::enable_picking($canvas, 1);
|
||||
# $canvas->enable_picking(1);
|
||||
#==============================================================================================================================
|
||||
$canvas->select_by('volume');
|
||||
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_select_by($canvas, 'volume');
|
||||
Slic3r::GUI::_3DScene::register_on_select_callback($canvas, sub {
|
||||
my ($volume_idx) = @_;
|
||||
# convert scene volume to model object volume
|
||||
@ -169,6 +165,8 @@ 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 }));
|
||||
|
||||
# $canvas->enable_picking(1);
|
||||
# $canvas->select_by('volume');
|
||||
# $canvas->on_select(sub {
|
||||
# my ($volume_idx) = @_;
|
||||
# # convert scene volume to model object volume
|
||||
|
@ -1857,6 +1857,21 @@ void _3DScene::set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons&
|
||||
return s_canvas_mgr.set_cutting_plane(canvas, z, polygons);
|
||||
}
|
||||
|
||||
void _3DScene::set_color_by(wxGLCanvas* canvas, const std::string& value)
|
||||
{
|
||||
return s_canvas_mgr.set_color_by(canvas, value);
|
||||
}
|
||||
|
||||
void _3DScene::set_select_by(wxGLCanvas* canvas, const std::string& value)
|
||||
{
|
||||
return s_canvas_mgr.set_select_by(canvas, value);
|
||||
}
|
||||
|
||||
void _3DScene::set_drag_by(wxGLCanvas* canvas, const std::string& value)
|
||||
{
|
||||
return s_canvas_mgr.set_drag_by(canvas, value);
|
||||
}
|
||||
|
||||
bool _3DScene::is_layers_editing_enabled(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.is_layers_editing_enabled(canvas);
|
||||
|
@ -575,6 +575,10 @@ public:
|
||||
|
||||
static void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons);
|
||||
|
||||
static void set_color_by(wxGLCanvas* canvas, const std::string& value);
|
||||
static void set_select_by(wxGLCanvas* canvas, const std::string& value);
|
||||
static void set_drag_by(wxGLCanvas* canvas, const std::string& value);
|
||||
|
||||
static bool is_layers_editing_enabled(wxGLCanvas* canvas);
|
||||
static bool is_layers_editing_allowed(wxGLCanvas* canvas);
|
||||
static bool is_shader_enabled(wxGLCanvas* canvas);
|
||||
|
@ -1149,6 +1149,21 @@ void GLCanvas3D::set_cutting_plane(float z, const ExPolygons& polygons)
|
||||
m_cutting_plane.set(z, polygons);
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_color_by(const std::string& value)
|
||||
{
|
||||
m_color_by = value;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_select_by(const std::string& value)
|
||||
{
|
||||
m_select_by = value;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_drag_by(const std::string& value)
|
||||
{
|
||||
m_drag_by = value;
|
||||
}
|
||||
|
||||
float GLCanvas3D::get_camera_zoom() const
|
||||
{
|
||||
return m_camera.zoom;
|
||||
|
@ -387,6 +387,10 @@ public:
|
||||
|
||||
void set_cutting_plane(float z, const ExPolygons& polygons);
|
||||
|
||||
void set_color_by(const std::string& value);
|
||||
void set_select_by(const std::string& value);
|
||||
void set_drag_by(const std::string& value);
|
||||
|
||||
float get_camera_zoom() const;
|
||||
|
||||
BoundingBoxf3 volumes_bounding_box() const;
|
||||
|
@ -317,6 +317,27 @@ void GLCanvas3DManager::set_cutting_plane(wxGLCanvas* canvas, float z, const ExP
|
||||
it->second->set_cutting_plane(z, polygons);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_color_by(wxGLCanvas* canvas, const std::string& value)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_color_by(value);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_select_by(wxGLCanvas* canvas, const std::string& value)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_select_by(value);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_drag_by(wxGLCanvas* canvas, const std::string& value)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_drag_by(value);
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::is_layers_editing_enabled(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
|
@ -70,6 +70,10 @@ public:
|
||||
|
||||
void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons);
|
||||
|
||||
void set_color_by(wxGLCanvas* canvas, const std::string& value);
|
||||
void set_select_by(wxGLCanvas* canvas, const std::string& value);
|
||||
void set_drag_by(wxGLCanvas* canvas, const std::string& value);
|
||||
|
||||
bool is_layers_editing_enabled(wxGLCanvas* canvas) const;
|
||||
bool is_layers_editing_allowed(wxGLCanvas* canvas) const;
|
||||
bool is_shader_enabled(wxGLCanvas* canvas) const;
|
||||
|
@ -275,6 +275,27 @@ set_cutting_plane(canvas, z, polygons)
|
||||
CODE:
|
||||
_3DScene::set_cutting_plane((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), z, polygons);
|
||||
|
||||
void
|
||||
set_color_by(canvas, value)
|
||||
SV *canvas;
|
||||
std::string value;
|
||||
CODE:
|
||||
_3DScene::set_color_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), value);
|
||||
|
||||
void
|
||||
set_select_by(canvas, value)
|
||||
SV *canvas;
|
||||
std::string value;
|
||||
CODE:
|
||||
_3DScene::set_select_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), value);
|
||||
|
||||
void
|
||||
set_drag_by(canvas, value)
|
||||
SV *canvas;
|
||||
std::string value;
|
||||
CODE:
|
||||
_3DScene::set_drag_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), value);
|
||||
|
||||
bool
|
||||
is_layers_editing_enabled(canvas)
|
||||
SV *canvas;
|
||||
|
Loading…
Reference in New Issue
Block a user