3DScene layers editing parameters moved to c++
This commit is contained in:
parent
a8311bd1bd
commit
951e8528b4
@ -201,11 +201,11 @@ sub new {
|
||||
# $self->_camera_distance(0.);
|
||||
# $self->layer_editing_enabled(0);
|
||||
# $self->{layer_height_edit_band_width} = 2.;
|
||||
# $self->{layer_height_edit_strength} = 0.005;
|
||||
# $self->{layer_height_edit_last_object_id} = -1;
|
||||
# $self->{layer_height_edit_last_z} = 0.;
|
||||
# $self->{layer_height_edit_last_action} = 0;
|
||||
#==============================================================================================================================
|
||||
$self->{layer_height_edit_strength} = 0.005;
|
||||
$self->{layer_height_edit_last_object_id} = -1;
|
||||
$self->{layer_height_edit_last_z} = 0.;
|
||||
$self->{layer_height_edit_last_action} = 0;
|
||||
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::reset_volumes($self);
|
||||
@ -267,7 +267,9 @@ sub new {
|
||||
EVT_TIMER($self, $self->{layer_height_edit_timer_id}, sub {
|
||||
my ($self, $event) = @_;
|
||||
return if $self->_layer_height_edited != 1;
|
||||
return if $self->{layer_height_edit_last_object_id} == -1;
|
||||
#==============================================================================================================================
|
||||
return if Slic3r::GUI::_3DScene::get_layers_editing_last_object_id($self) == -1;
|
||||
#==============================================================================================================================
|
||||
$self->_variable_layer_thickness_action(undef);
|
||||
});
|
||||
|
||||
@ -419,40 +421,73 @@ sub _variable_layer_thickness_reset_rect_mouse_inside {
|
||||
return $mouse_evt->GetX >= $bar_left && $mouse_evt->GetX <= $bar_right && $mouse_evt->GetY >= $bar_top && $mouse_evt->GetY <= $bar_bottom;
|
||||
}
|
||||
|
||||
sub _variable_layer_thickness_bar_mouse_cursor_z_relative {
|
||||
my ($self) = @_;
|
||||
my $mouse_pos = $self->ScreenToClientPoint(Wx::GetMousePosition());
|
||||
my ($bar_left, $bar_top, $bar_right, $bar_bottom) = $self->_variable_layer_thickness_bar_rect_screen;
|
||||
return ($mouse_pos->x >= $bar_left && $mouse_pos->x <= $bar_right && $mouse_pos->y >= $bar_top && $mouse_pos->y <= $bar_bottom) ?
|
||||
# Inside the bar.
|
||||
($bar_bottom - $mouse_pos->y - 1.) / ($bar_bottom - $bar_top - 1) :
|
||||
# Outside the bar.
|
||||
-1000.;
|
||||
}
|
||||
#==============================================================================================================================
|
||||
#sub _variable_layer_thickness_bar_mouse_cursor_z_relative {
|
||||
# my ($self) = @_;
|
||||
# my $mouse_pos = $self->ScreenToClientPoint(Wx::GetMousePosition());
|
||||
# my ($bar_left, $bar_top, $bar_right, $bar_bottom) = $self->_variable_layer_thickness_bar_rect_screen;
|
||||
# return ($mouse_pos->x >= $bar_left && $mouse_pos->x <= $bar_right && $mouse_pos->y >= $bar_top && $mouse_pos->y <= $bar_bottom) ?
|
||||
# # Inside the bar.
|
||||
# ($bar_bottom - $mouse_pos->y - 1.) / ($bar_bottom - $bar_top - 1) :
|
||||
# # Outside the bar.
|
||||
# -1000.;
|
||||
#}
|
||||
#==============================================================================================================================
|
||||
|
||||
sub _variable_layer_thickness_action {
|
||||
my ($self, $mouse_event, $do_modification) = @_;
|
||||
#==============================================================================================================================
|
||||
my $object_idx_selected = Slic3r::GUI::_3DScene::get_layers_editing_last_object_id($self);
|
||||
# A volume is selected. Test, whether hovering over a layer thickness bar.
|
||||
return if $self->{layer_height_edit_last_object_id} == -1;
|
||||
return if ($object_idx_selected == -1);
|
||||
# return if $self->{layer_height_edit_last_object_id} == -1;
|
||||
#==============================================================================================================================
|
||||
if (defined($mouse_event)) {
|
||||
my ($bar_left, $bar_top, $bar_right, $bar_bottom) = $self->_variable_layer_thickness_bar_rect_screen;
|
||||
$self->{layer_height_edit_last_z} = unscale($self->{print}->get_object($self->{layer_height_edit_last_object_id})->size->z)
|
||||
* ($bar_bottom - $mouse_event->GetY - 1.) / ($bar_bottom - $bar_top);
|
||||
$self->{layer_height_edit_last_action} = $mouse_event->ShiftDown ? ($mouse_event->RightIsDown ? 3 : 2) : ($mouse_event->RightIsDown ? 0 : 1);
|
||||
#==============================================================================================================================
|
||||
Slic3r::GUI::_3DScene::set_layers_editing_last_z($self, unscale($self->{print}->get_object($object_idx_selected)->size->z)
|
||||
* ($bar_bottom - $mouse_event->GetY - 1.) / ($bar_bottom - $bar_top));
|
||||
Slic3r::GUI::_3DScene::set_layers_editing_last_action($self, $mouse_event->ShiftDown ? ($mouse_event->RightIsDown ? 3 : 2) : ($mouse_event->RightIsDown ? 0 : 1));
|
||||
# $self->{layer_height_edit_last_z} = unscale($self->{print}->get_object($self->{layer_height_edit_last_object_id})->size->z)
|
||||
# * ($bar_bottom - $mouse_event->GetY - 1.) / ($bar_bottom - $bar_top);
|
||||
# $self->{layer_height_edit_last_action} = $mouse_event->ShiftDown ? ($mouse_event->RightIsDown ? 3 : 2) : ($mouse_event->RightIsDown ? 0 : 1);
|
||||
#==============================================================================================================================
|
||||
}
|
||||
# Mark the volume as modified, so Print will pick its layer height profile? Where to mark it?
|
||||
# Start a timer to refresh the print? schedule_background_process() ?
|
||||
# The PrintObject::adjust_layer_height_profile() call adjusts the profile of its associated ModelObject, it does not modify the profile of the PrintObject itself.
|
||||
$self->{print}->get_object($self->{layer_height_edit_last_object_id})->adjust_layer_height_profile(
|
||||
$self->{layer_height_edit_last_z},
|
||||
$self->{layer_height_edit_strength},
|
||||
#==============================================================================================================================
|
||||
$self->{print}->get_object($object_idx_selected)->adjust_layer_height_profile(
|
||||
Slic3r::GUI::_3DScene::get_layers_editing_last_z($self),
|
||||
Slic3r::GUI::_3DScene::get_layers_editing_strength($self),
|
||||
Slic3r::GUI::_3DScene::get_layers_editing_band_width($self),
|
||||
Slic3r::GUI::_3DScene::get_layers_editing_last_action($self));
|
||||
# $self->{print}->get_object($self->{layer_height_edit_last_object_id})->adjust_layer_height_profile(
|
||||
# $self->{layer_height_edit_last_z},
|
||||
# $self->{layer_height_edit_strength},
|
||||
# $self->{layer_height_edit_band_width},
|
||||
# $self->{layer_height_edit_last_action});
|
||||
#==============================================================================================================================
|
||||
|
||||
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MERGE FROM SCENE_MANIPULATORS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
# searches the id of the first volume of the selected object
|
||||
my $volume_idx = 0;
|
||||
for my $i (0..$object_idx_selected - 1) {
|
||||
my $obj = $self->{print}->get_object($i);
|
||||
for my $j (0..$obj->region_volumes_count - 1) {
|
||||
$volume_idx += scalar @{$obj->get_region_volumes($j)};
|
||||
}
|
||||
}
|
||||
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MERGE FROM SCENE_MANIPULATORS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
#==============================================================================================================================
|
||||
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MERGE FROM SCENE_MANIPULATORS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
$self->volumes->[$volume_idx]->generate_layer_height_texture($self->{print}->get_object($object_idx_selected), 1);
|
||||
# $self->volumes->[$object_idx_selected]->generate_layer_height_texture($self->{print}->get_object($object_idx_selected), 1);
|
||||
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MERGE FROM SCENE_MANIPULATORS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
# $self->volumes->[$self->{layer_height_edit_last_object_id}]->generate_layer_height_texture(
|
||||
# $self->{print}->get_object($self->{layer_height_edit_last_object_id}), 1);
|
||||
#==============================================================================================================================
|
||||
$self->{layer_height_edit_last_action});
|
||||
$self->volumes->[$self->{layer_height_edit_last_object_id}]->generate_layer_height_texture(
|
||||
$self->{print}->get_object($self->{layer_height_edit_last_object_id}), 1);
|
||||
$self->Refresh;
|
||||
# Automatic action on mouse down with the same coordinate.
|
||||
$self->{layer_height_edit_timer}->Start(100, wxTIMER_CONTINUOUS);
|
||||
@ -463,7 +498,8 @@ sub mouse_event {
|
||||
|
||||
my $pos = Slic3r::Pointf->new($e->GetPositionXY);
|
||||
#==============================================================================================================================
|
||||
my $object_idx_selected = $self->{layer_height_edit_last_object_id} = (Slic3r::GUI::_3DScene::is_layers_editing_enabled($self) && $self->{print}) ? $self->_first_selected_object_id_for_variable_layer_height_editing : -1;
|
||||
my $object_idx_selected = (Slic3r::GUI::_3DScene::is_layers_editing_enabled($self) && $self->{print}) ? $self->_first_selected_object_id_for_variable_layer_height_editing : -1;
|
||||
Slic3r::GUI::_3DScene::set_layers_editing_last_object_id($self, $object_idx_selected);
|
||||
# my $object_idx_selected = $self->{layer_height_edit_last_object_id} = ($self->layer_editing_enabled && $self->{print}) ? $self->_first_selected_object_id_for_variable_layer_height_editing : -1;
|
||||
#==============================================================================================================================
|
||||
|
||||
@ -1718,7 +1754,7 @@ sub mark_volumes_for_layer_height {
|
||||
if (Slic3r::GUI::_3DScene::is_layers_editing_enabled($self) && $shader && $volume->selected &&
|
||||
$volume->has_layer_height_texture && $object_id < $self->{print}->object_count) {
|
||||
$volume->set_layer_height_texture_data(Slic3r::GUI::_3DScene::get_layers_editing_z_texture_id($self), $shader->shader_program_id,
|
||||
$self->{print}->get_object($object_id), $self->_variable_layer_thickness_bar_mouse_cursor_z_relative, Slic3r::GUI::_3DScene::get_layers_editing_band_width($self));
|
||||
$self->{print}->get_object($object_id), Slic3r::GUI::_3DScene::get_layers_editing_cursor_z_relative($self), Slic3r::GUI::_3DScene::get_layers_editing_band_width($self));
|
||||
|
||||
# if ($self->layer_editing_enabled && $volume->selected && $self->{layer_height_edit_shader} &&
|
||||
# $volume->has_layer_height_texture && $object_id < $self->{print}->object_count) {
|
||||
|
@ -2025,11 +2025,56 @@ void _3DScene::set_layers_editing_band_width(wxGLCanvas* canvas, float band_widt
|
||||
s_canvas_mgr.set_layers_editing_band_width(canvas, band_width);
|
||||
}
|
||||
|
||||
float _3DScene::get_layers_editing_strength(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.get_layers_editing_strength(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::set_layers_editing_strength(wxGLCanvas* canvas, float strength)
|
||||
{
|
||||
s_canvas_mgr.set_layers_editing_strength(canvas, strength);
|
||||
}
|
||||
|
||||
int _3DScene::get_layers_editing_last_object_id(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.get_layers_editing_last_object_id(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::set_layers_editing_last_object_id(wxGLCanvas* canvas, int id)
|
||||
{
|
||||
s_canvas_mgr.set_layers_editing_last_object_id(canvas, id);
|
||||
}
|
||||
|
||||
float _3DScene::get_layers_editing_last_z(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.get_layers_editing_last_z(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::set_layers_editing_last_z(wxGLCanvas* canvas, float z)
|
||||
{
|
||||
s_canvas_mgr.set_layers_editing_last_z(canvas, z);
|
||||
}
|
||||
|
||||
unsigned int _3DScene::get_layers_editing_last_action(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.get_layers_editing_last_action(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::set_layers_editing_last_action(wxGLCanvas* canvas, unsigned int action)
|
||||
{
|
||||
s_canvas_mgr.set_layers_editing_last_action(canvas, action);
|
||||
}
|
||||
|
||||
GLShader* _3DScene::get_layers_editing_shader(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.get_layers_editing_shader(canvas);
|
||||
}
|
||||
|
||||
float _3DScene::get_layers_editing_cursor_z_relative(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.get_layers_editing_cursor_z_relative(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::zoom_to_bed(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.zoom_to_bed(canvas);
|
||||
|
@ -622,8 +622,22 @@ public:
|
||||
static float get_layers_editing_band_width(wxGLCanvas* canvas);
|
||||
static void set_layers_editing_band_width(wxGLCanvas* canvas, float band_width);
|
||||
|
||||
static float get_layers_editing_strength(wxGLCanvas* canvas);
|
||||
static void set_layers_editing_strength(wxGLCanvas* canvas, float strength);
|
||||
|
||||
static int get_layers_editing_last_object_id(wxGLCanvas* canvas);
|
||||
static void set_layers_editing_last_object_id(wxGLCanvas* canvas, int id);
|
||||
|
||||
static float get_layers_editing_last_z(wxGLCanvas* canvas);
|
||||
static void set_layers_editing_last_z(wxGLCanvas* canvas, float z);
|
||||
|
||||
static unsigned int get_layers_editing_last_action(wxGLCanvas* canvas);
|
||||
static void set_layers_editing_last_action(wxGLCanvas* canvas, unsigned int action);
|
||||
|
||||
static GLShader* get_layers_editing_shader(wxGLCanvas* canvas);
|
||||
|
||||
static float get_layers_editing_cursor_z_relative(wxGLCanvas* canvas);
|
||||
|
||||
static void zoom_to_bed(wxGLCanvas* canvas);
|
||||
static void zoom_to_volumes(wxGLCanvas* canvas);
|
||||
static void select_view(wxGLCanvas* canvas, const std::string& direction);
|
||||
|
@ -593,6 +593,10 @@ GLCanvas3D::LayersEditing::LayersEditing()
|
||||
, m_enabled(false)
|
||||
, m_z_texture_id(0)
|
||||
, m_band_width(2.0f)
|
||||
, m_strength(0.005f)
|
||||
, m_last_object_id(-1)
|
||||
, m_last_z(0.0f)
|
||||
, m_last_action(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -669,6 +673,46 @@ void GLCanvas3D::LayersEditing::set_band_width(float band_width)
|
||||
m_band_width = band_width;
|
||||
}
|
||||
|
||||
float GLCanvas3D::LayersEditing::get_strength() const
|
||||
{
|
||||
return m_strength;
|
||||
}
|
||||
|
||||
void GLCanvas3D::LayersEditing::set_strength(float strength)
|
||||
{
|
||||
m_strength = strength;
|
||||
}
|
||||
|
||||
int GLCanvas3D::LayersEditing::get_last_object_id() const
|
||||
{
|
||||
return m_last_object_id;
|
||||
}
|
||||
|
||||
void GLCanvas3D::LayersEditing::set_last_object_id(int id)
|
||||
{
|
||||
m_last_object_id = id;
|
||||
}
|
||||
|
||||
float GLCanvas3D::LayersEditing::get_last_z() const
|
||||
{
|
||||
return m_last_z;
|
||||
}
|
||||
|
||||
void GLCanvas3D::LayersEditing::set_last_z(float z)
|
||||
{
|
||||
m_last_z = z;
|
||||
}
|
||||
|
||||
unsigned int GLCanvas3D::LayersEditing::get_last_action() const
|
||||
{
|
||||
return m_last_action;
|
||||
}
|
||||
|
||||
void GLCanvas3D::LayersEditing::set_last_action(unsigned int action)
|
||||
{
|
||||
m_last_action = action;
|
||||
}
|
||||
|
||||
void GLCanvas3D::LayersEditing::render(const GLCanvas3D& canvas, const PrintObject& print_object, const GLVolume& volume) const
|
||||
{
|
||||
if (!m_enabled)
|
||||
@ -700,6 +744,22 @@ GLShader* GLCanvas3D::LayersEditing::get_shader()
|
||||
return m_shader.get_shader();
|
||||
}
|
||||
|
||||
float GLCanvas3D::LayersEditing::get_cursor_z_relative(const GLCanvas3D& canvas) const
|
||||
{
|
||||
const Point& mouse_pos = canvas.get_local_mouse_position();
|
||||
const Rect& bar_rect = _get_bar_rect_screen(canvas);
|
||||
float x = (float)mouse_pos.x;
|
||||
float y = (float)mouse_pos.y;
|
||||
float t = bar_rect.get_top();
|
||||
float b = bar_rect.get_bottom();
|
||||
|
||||
return ((bar_rect.get_left() <= x) && (x <= bar_rect.get_right()) && (t <= y) && (y <= b)) ?
|
||||
// Inside the bar.
|
||||
(b - y - 1.0f) / (b - t - 1.0f) :
|
||||
// Outside the bar.
|
||||
-1000.0f;
|
||||
}
|
||||
|
||||
bool GLCanvas3D::LayersEditing::_is_initialized() const
|
||||
{
|
||||
return m_shader.is_initialized();
|
||||
@ -796,7 +856,7 @@ void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas
|
||||
|
||||
m_shader.set_uniform("z_to_texture_row", (float)volume.layer_height_texture_z_to_row_id());
|
||||
m_shader.set_uniform("z_texture_row_to_normalized", 1.0f / (float)volume.layer_height_texture_height());
|
||||
m_shader.set_uniform("z_cursor", max_z * _cursor_z_relative(canvas));
|
||||
m_shader.set_uniform("z_cursor", max_z * get_cursor_z_relative(canvas));
|
||||
m_shader.set_uniform("z_cursor_band_width", get_band_width());
|
||||
|
||||
GLsizei w = (GLsizei)volume.layer_height_texture_width();
|
||||
@ -924,21 +984,6 @@ Rect GLCanvas3D::LayersEditing::_get_reset_rect_viewport(const GLCanvas3D& canva
|
||||
return Rect((half_w - VARIABLE_LAYER_THICKNESS_BAR_WIDTH) * inv_zoom, (-half_h + VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT) * inv_zoom, half_w * inv_zoom, -half_h * inv_zoom);
|
||||
}
|
||||
|
||||
float GLCanvas3D::LayersEditing::_cursor_z_relative(const GLCanvas3D& canvas) const
|
||||
{
|
||||
const Point& mouse_pos = canvas.get_local_mouse_position();
|
||||
const Rect& bar_rect = _get_bar_rect_screen(canvas);
|
||||
float x = (float)mouse_pos.x;
|
||||
float y = (float)mouse_pos.y;
|
||||
float t = bar_rect.get_top();
|
||||
float b = bar_rect.get_bottom();
|
||||
return ((bar_rect.get_left() <= x) && (x <= bar_rect.get_right()) && (t <= y) && (y <= b)) ?
|
||||
// Inside the bar.
|
||||
(b - y - 1.0f) / (b - t - 1.0f) :
|
||||
// Outside the bar.
|
||||
- 1000.0f;
|
||||
}
|
||||
|
||||
GLCanvas3D::Mouse::Mouse()
|
||||
: m_dragging(false)
|
||||
{
|
||||
@ -1559,11 +1604,56 @@ void GLCanvas3D::set_layers_editing_band_width(float band_width)
|
||||
m_layers_editing.set_band_width(band_width);
|
||||
}
|
||||
|
||||
float GLCanvas3D::get_layers_editing_strength() const
|
||||
{
|
||||
return m_layers_editing.get_strength();
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_layers_editing_strength(float strength)
|
||||
{
|
||||
m_layers_editing.set_strength(strength);
|
||||
}
|
||||
|
||||
int GLCanvas3D::get_layers_editing_last_object_id() const
|
||||
{
|
||||
return m_layers_editing.get_last_object_id();
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_layers_editing_last_object_id(int id)
|
||||
{
|
||||
m_layers_editing.set_last_object_id(id);
|
||||
}
|
||||
|
||||
float GLCanvas3D::get_layers_editing_last_z() const
|
||||
{
|
||||
return m_layers_editing.get_last_z();
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_layers_editing_last_z(float z)
|
||||
{
|
||||
m_layers_editing.set_last_z(z);
|
||||
}
|
||||
|
||||
unsigned int GLCanvas3D::get_layers_editing_last_action() const
|
||||
{
|
||||
return m_layers_editing.get_last_action();
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_layers_editing_last_action(unsigned int action)
|
||||
{
|
||||
m_layers_editing.set_last_action(action);
|
||||
}
|
||||
|
||||
GLShader* GLCanvas3D::get_layers_editing_shader()
|
||||
{
|
||||
return m_layers_editing.get_shader();
|
||||
}
|
||||
|
||||
float GLCanvas3D::get_layers_editing_cursor_z_relative(const GLCanvas3D& canvas) const
|
||||
{
|
||||
return m_layers_editing.get_cursor_z_relative(canvas);
|
||||
}
|
||||
|
||||
void GLCanvas3D::render_bed() const
|
||||
{
|
||||
m_bed.render();
|
||||
@ -1877,7 +1967,7 @@ Point GLCanvas3D::get_local_mouse_position() const
|
||||
return Point();
|
||||
|
||||
wxPoint mouse_pos = m_canvas->ScreenToClient(wxGetMousePosition());
|
||||
return Point(mouse_pos.x, mouse_pos.x);
|
||||
return Point(mouse_pos.x, mouse_pos.y);
|
||||
}
|
||||
|
||||
void GLCanvas3D::_zoom_to_bounding_box(const BoundingBoxf3& bbox)
|
||||
|
@ -218,6 +218,10 @@ public:
|
||||
mutable GLTextureData m_tooltip_texture;
|
||||
mutable GLTextureData m_reset_texture;
|
||||
float m_band_width;
|
||||
float m_strength;
|
||||
int m_last_object_id;
|
||||
float m_last_z;
|
||||
unsigned int m_last_action;
|
||||
|
||||
public:
|
||||
LayersEditing();
|
||||
@ -236,10 +240,24 @@ public:
|
||||
float get_band_width() const;
|
||||
void set_band_width(float band_width);
|
||||
|
||||
float get_strength() const;
|
||||
void set_strength(float strength);
|
||||
|
||||
int get_last_object_id() const;
|
||||
void set_last_object_id(int id);
|
||||
|
||||
float get_last_z() const;
|
||||
void set_last_z(float z);
|
||||
|
||||
unsigned int get_last_action() const;
|
||||
void set_last_action(unsigned int action);
|
||||
|
||||
void render(const GLCanvas3D& canvas, const PrintObject& print_object, const GLVolume& volume) const;
|
||||
|
||||
GLShader* get_shader();
|
||||
|
||||
float get_cursor_z_relative(const GLCanvas3D& canvas) const;
|
||||
|
||||
private:
|
||||
bool _is_initialized() const;
|
||||
GLTextureData _load_texture_from_file(const std::string& filename) const;
|
||||
@ -251,7 +269,6 @@ public:
|
||||
Rect _get_reset_rect_screen(const GLCanvas3D& canvas) const;
|
||||
Rect _get_bar_rect_viewport(const GLCanvas3D& canvas) const;
|
||||
Rect _get_reset_rect_viewport(const GLCanvas3D& canvas) const;
|
||||
float _cursor_z_relative(const GLCanvas3D& canvas) const;
|
||||
};
|
||||
|
||||
class Mouse
|
||||
@ -384,8 +401,22 @@ public:
|
||||
float get_layers_editing_band_width() const;
|
||||
void set_layers_editing_band_width(float band_width);
|
||||
|
||||
float get_layers_editing_strength() const;
|
||||
void set_layers_editing_strength(float strength);
|
||||
|
||||
int get_layers_editing_last_object_id() const;
|
||||
void set_layers_editing_last_object_id(int id);
|
||||
|
||||
float get_layers_editing_last_z() const;
|
||||
void set_layers_editing_last_z(float z);
|
||||
|
||||
unsigned int get_layers_editing_last_action() const;
|
||||
void set_layers_editing_last_action(unsigned int action);
|
||||
|
||||
GLShader* get_layers_editing_shader();
|
||||
|
||||
float get_layers_editing_cursor_z_relative(const GLCanvas3D& canvas) const;
|
||||
|
||||
void zoom_to_bed();
|
||||
void zoom_to_volumes();
|
||||
void select_view(const std::string& direction);
|
||||
|
@ -492,12 +492,70 @@ void GLCanvas3DManager::set_layers_editing_band_width(wxGLCanvas* canvas, float
|
||||
it->second->set_layers_editing_band_width(band_width);
|
||||
}
|
||||
|
||||
float GLCanvas3DManager::get_layers_editing_strength(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_layers_editing_strength() : 0.0f;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_layers_editing_strength(wxGLCanvas* canvas, float strength)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_layers_editing_strength(strength);
|
||||
}
|
||||
|
||||
int GLCanvas3DManager::get_layers_editing_last_object_id(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_layers_editing_last_object_id() : -1;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_layers_editing_last_object_id(wxGLCanvas* canvas, int id)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_layers_editing_last_object_id(id);
|
||||
}
|
||||
|
||||
float GLCanvas3DManager::get_layers_editing_last_z(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_layers_editing_last_z() : 0.0f;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_layers_editing_last_z(wxGLCanvas* canvas, float z)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_layers_editing_last_z(z);
|
||||
}
|
||||
|
||||
unsigned int GLCanvas3DManager::get_layers_editing_last_action(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_layers_editing_last_action() : 0;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_layers_editing_last_action(wxGLCanvas* canvas, unsigned int action)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_layers_editing_last_action(action);
|
||||
}
|
||||
|
||||
GLShader* GLCanvas3DManager::get_layers_editing_shader(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_layers_editing_shader() : nullptr;
|
||||
}
|
||||
|
||||
float GLCanvas3DManager::get_layers_editing_cursor_z_relative(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_layers_editing_cursor_z_relative(*it->second) : 0.0f;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::zoom_to_bed(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
|
@ -122,8 +122,22 @@ public:
|
||||
float get_layers_editing_band_width(wxGLCanvas* canvas) const;
|
||||
void set_layers_editing_band_width(wxGLCanvas* canvas, float band_width);
|
||||
|
||||
float get_layers_editing_strength(wxGLCanvas* canvas) const;
|
||||
void set_layers_editing_strength(wxGLCanvas* canvas, float strength);
|
||||
|
||||
int get_layers_editing_last_object_id(wxGLCanvas* canvas) const;
|
||||
void set_layers_editing_last_object_id(wxGLCanvas* canvas, int id);
|
||||
|
||||
float get_layers_editing_last_z(wxGLCanvas* canvas) const;
|
||||
void set_layers_editing_last_z(wxGLCanvas* canvas, float z);
|
||||
|
||||
unsigned int get_layers_editing_last_action(wxGLCanvas* canvas) const;
|
||||
void set_layers_editing_last_action(wxGLCanvas* canvas, unsigned int action);
|
||||
|
||||
GLShader* get_layers_editing_shader(wxGLCanvas* canvas);
|
||||
|
||||
float get_layers_editing_cursor_z_relative(wxGLCanvas* canvas) const;
|
||||
|
||||
void zoom_to_bed(wxGLCanvas* canvas);
|
||||
void zoom_to_volumes(wxGLCanvas* canvas);
|
||||
void select_view(wxGLCanvas* canvas, const std::string& direction);
|
||||
|
@ -594,6 +594,66 @@ set_layers_editing_band_width(canvas, band_width)
|
||||
CODE:
|
||||
_3DScene::set_layers_editing_band_width((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), band_width);
|
||||
|
||||
float
|
||||
get_layers_editing_strength(canvas)
|
||||
SV *canvas;
|
||||
CODE:
|
||||
RETVAL = _3DScene::get_layers_editing_strength((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
set_layers_editing_strength(canvas, strength)
|
||||
SV *canvas;
|
||||
float strength;
|
||||
CODE:
|
||||
_3DScene::set_layers_editing_strength((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), strength);
|
||||
|
||||
int
|
||||
get_layers_editing_last_object_id(canvas)
|
||||
SV *canvas;
|
||||
CODE:
|
||||
RETVAL = _3DScene::get_layers_editing_last_object_id((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
set_layers_editing_last_object_id(canvas, id)
|
||||
SV *canvas;
|
||||
int id;
|
||||
CODE:
|
||||
_3DScene::set_layers_editing_last_object_id((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), id);
|
||||
|
||||
float
|
||||
get_layers_editing_last_z(canvas)
|
||||
SV *canvas;
|
||||
CODE:
|
||||
RETVAL = _3DScene::get_layers_editing_last_z((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
set_layers_editing_last_z(canvas, z)
|
||||
SV *canvas;
|
||||
float z;
|
||||
CODE:
|
||||
_3DScene::set_layers_editing_last_z((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), z);
|
||||
|
||||
unsigned int
|
||||
get_layers_editing_last_action(canvas)
|
||||
SV *canvas;
|
||||
CODE:
|
||||
RETVAL = _3DScene::get_layers_editing_last_action((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
set_layers_editing_last_action(canvas, action)
|
||||
SV *canvas;
|
||||
unsigned int action;
|
||||
CODE:
|
||||
_3DScene::set_layers_editing_last_action((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), action);
|
||||
|
||||
Ref<GLShader>
|
||||
get_layers_editing_shader(canvas)
|
||||
SV *canvas;
|
||||
@ -601,7 +661,15 @@ get_layers_editing_shader(canvas)
|
||||
RETVAL = _3DScene::get_layers_editing_shader((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
|
||||
float
|
||||
get_layers_editing_cursor_z_relative(canvas)
|
||||
SV *canvas;
|
||||
CODE:
|
||||
RETVAL = _3DScene::get_layers_editing_cursor_z_relative((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
zoom_to_bed(canvas)
|
||||
SV *canvas;
|
||||
|
@ -52,6 +52,9 @@ _constant()
|
||||
int region_count()
|
||||
%code%{ RETVAL = THIS->print()->regions.size(); %};
|
||||
|
||||
int region_volumes_count()
|
||||
%code%{ RETVAL = THIS->region_volumes.size(); %};
|
||||
|
||||
Ref<Print> print();
|
||||
Ref<ModelObject> model_object();
|
||||
Ref<StaticPrintConfig> config()
|
||||
|
Loading…
Reference in New Issue
Block a user