mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-19 06:45:56 +08:00
Properly display the unretraction travel moves
This is required due to the addition of the MoveUnretraction segment type in the engine. Those moves need to be displayed as travel moves, with a new color. CURA-11830
This commit is contained in:
parent
61fc689058
commit
34a746654d
@ -83,6 +83,7 @@ class LayerDataBuilder(MeshBuilder):
|
|||||||
# Set material_colors with indices where line_types (also numpy array) == MoveCombingType
|
# Set material_colors with indices where line_types (also numpy array) == MoveCombingType
|
||||||
material_colors[line_types == LayerPolygon.MoveCombingType] = colors[line_types == LayerPolygon.MoveCombingType]
|
material_colors[line_types == LayerPolygon.MoveCombingType] = colors[line_types == LayerPolygon.MoveCombingType]
|
||||||
material_colors[line_types == LayerPolygon.MoveRetractionType] = colors[line_types == LayerPolygon.MoveRetractionType]
|
material_colors[line_types == LayerPolygon.MoveRetractionType] = colors[line_types == LayerPolygon.MoveRetractionType]
|
||||||
|
material_colors[line_types == LayerPolygon.MoveUnretractionType] = colors[line_types == LayerPolygon.MoveUnretractionType]
|
||||||
|
|
||||||
attributes = {
|
attributes = {
|
||||||
"line_dimensions": {
|
"line_dimensions": {
|
||||||
|
@ -23,11 +23,12 @@ class LayerPolygon:
|
|||||||
MoveRetractionType = 9
|
MoveRetractionType = 9
|
||||||
SupportInterfaceType = 10
|
SupportInterfaceType = 10
|
||||||
PrimeTowerType = 11
|
PrimeTowerType = 11
|
||||||
__number_of_types = 12
|
MoveUnretractionType = 12
|
||||||
|
__number_of_types = 13
|
||||||
|
|
||||||
__jump_map = numpy.logical_or(numpy.logical_or(numpy.arange(__number_of_types) == NoneType,
|
__jump_map = numpy.logical_or(numpy.arange(__number_of_types) == NoneType, numpy.arange(__number_of_types) == MoveCombingType)
|
||||||
numpy.arange(__number_of_types) == MoveCombingType),
|
__jump_map = numpy.logical_or(__jump_map, numpy.arange(__number_of_types) == MoveRetractionType)
|
||||||
numpy.arange(__number_of_types) == MoveRetractionType)
|
__jump_map = numpy.logical_or(__jump_map, numpy.arange(__number_of_types) == MoveUnretractionType)
|
||||||
|
|
||||||
def __init__(self, extruder: int, line_types: numpy.ndarray, data: numpy.ndarray,
|
def __init__(self, extruder: int, line_types: numpy.ndarray, data: numpy.ndarray,
|
||||||
line_widths: numpy.ndarray, line_thicknesses: numpy.ndarray, line_feedrates: numpy.ndarray) -> None:
|
line_widths: numpy.ndarray, line_thicknesses: numpy.ndarray, line_feedrates: numpy.ndarray) -> None:
|
||||||
@ -272,7 +273,8 @@ class LayerPolygon:
|
|||||||
theme.getColor("layerview_move_combing").getRgbF(), # MoveCombingType
|
theme.getColor("layerview_move_combing").getRgbF(), # MoveCombingType
|
||||||
theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractionType
|
theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractionType
|
||||||
theme.getColor("layerview_support_interface").getRgbF(), # SupportInterfaceType
|
theme.getColor("layerview_support_interface").getRgbF(), # SupportInterfaceType
|
||||||
theme.getColor("layerview_prime_tower").getRgbF() # PrimeTowerType
|
theme.getColor("layerview_prime_tower").getRgbF(), # PrimeTowerType
|
||||||
|
theme.getColor("layerview_move_unretraction").getRgbF(), # MoveUnretractionType
|
||||||
])
|
])
|
||||||
|
|
||||||
return cls.__color_map
|
return cls.__color_map
|
||||||
|
@ -133,7 +133,7 @@ class FlavorParser:
|
|||||||
if i > 0:
|
if i > 0:
|
||||||
line_feedrates[i - 1] = point[3]
|
line_feedrates[i - 1] = point[3]
|
||||||
line_types[i - 1] = point[5]
|
line_types[i - 1] = point[5]
|
||||||
if point[5] in [LayerPolygon.MoveCombingType, LayerPolygon.MoveRetractionType]:
|
if point[5] in [LayerPolygon.MoveCombingType, LayerPolygon.MoveRetractionType, LayerPolygon.MoveUnretractionType]:
|
||||||
line_widths[i - 1] = 0.1
|
line_widths[i - 1] = 0.1
|
||||||
line_thicknesses[i - 1] = 0.0 # Travels are set as zero thickness lines
|
line_thicknesses[i - 1] = 0.0 # Travels are set as zero thickness lines
|
||||||
else:
|
else:
|
||||||
|
@ -603,6 +603,7 @@ class SimulationView(CuraView):
|
|||||||
if self.getShowTravelMoves():
|
if self.getShowTravelMoves():
|
||||||
visible_line_types.append(LayerPolygon.MoveCombingType)
|
visible_line_types.append(LayerPolygon.MoveCombingType)
|
||||||
visible_line_types.append(LayerPolygon.MoveRetractionType)
|
visible_line_types.append(LayerPolygon.MoveRetractionType)
|
||||||
|
visible_line_types.append(LayerPolygon.MoveUnretractionType)
|
||||||
|
|
||||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||||
layer_data = node.callDecoration("getLayerData")
|
layer_data = node.callDecoration("getLayerData")
|
||||||
|
@ -22,8 +22,8 @@ vertex =
|
|||||||
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
||||||
// shade the color depending on the extruder index
|
// shade the color depending on the extruder index
|
||||||
v_color = a_color;
|
v_color = a_color;
|
||||||
// 8 and 9 are travel moves
|
// 8, 9 and 12 are travel moves
|
||||||
if ((a_line_type != 8.0) && (a_line_type != 9.0)) {
|
if ((a_line_type != 8.0) && (a_line_type != 9.0) && (a_line_type != 12.0) {
|
||||||
v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
|
v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,11 @@ fragment =
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9
|
// travel moves: 8, 9 or 12
|
||||||
|
if ((u_show_travel_moves == 0) &&
|
||||||
|
(((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 12.5))))
|
||||||
|
{
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
@ -120,7 +124,11 @@ fragment41core =
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9
|
// travel moves: 8, 9 or 12
|
||||||
|
if ((u_show_travel_moves == 0) &&
|
||||||
|
(((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 12.5))))
|
||||||
|
{
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
@ -242,8 +242,8 @@ geometry41core =
|
|||||||
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
|
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType
|
// See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType, 12 is MoveUnretractionType
|
||||||
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) {
|
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10) || v_line_type[0] == 11)) {
|
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10) || v_line_type[0] == 11)) {
|
||||||
@ -256,7 +256,7 @@ geometry41core =
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12)) {
|
||||||
// fixed size for movements
|
// fixed size for movements
|
||||||
size_x = 0.05;
|
size_x = 0.05;
|
||||||
} else {
|
} else {
|
||||||
@ -274,7 +274,7 @@ geometry41core =
|
|||||||
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0); //Upwards normal vector.
|
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0); //Upwards normal vector.
|
||||||
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0); //Upwards offset vector. Goes up by half the layer thickness.
|
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0); //Upwards offset vector. Goes up by half the layer thickness.
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) { //Travel or retraction moves.
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12)) { //Travel or retraction moves.
|
||||||
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
||||||
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
|
@ -109,8 +109,8 @@ geometry41core =
|
|||||||
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
|
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType
|
// See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType, 12 is MoveUnretractionType
|
||||||
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) {
|
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) {
|
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) {
|
||||||
@ -123,7 +123,7 @@ geometry41core =
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12)) {
|
||||||
// fixed size for movements
|
// fixed size for movements
|
||||||
size_x = 0.05;
|
size_x = 0.05;
|
||||||
} else {
|
} else {
|
||||||
@ -141,7 +141,7 @@ geometry41core =
|
|||||||
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0);
|
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0);
|
||||||
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0);
|
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0);
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12)) {
|
||||||
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
||||||
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
|
@ -48,8 +48,10 @@ fragment =
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5))
|
// travel moves: 8, 9 or 12
|
||||||
{ // actually, 8 and 9
|
if ((u_show_travel_moves == 0) &&
|
||||||
|
(((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 12.5))))
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
@ -124,7 +126,10 @@ fragment41core =
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9
|
// travel moves: 8, 9 or 12
|
||||||
|
if ((u_show_travel_moves == 0) &&
|
||||||
|
(((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 12.5))))
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
@ -465,6 +465,7 @@
|
|||||||
"layerview_move_retraction": [128, 127, 255, 255],
|
"layerview_move_retraction": [128, 127, 255, 255],
|
||||||
"layerview_support_interface": [63, 127, 255, 127],
|
"layerview_support_interface": [63, 127, 255, 127],
|
||||||
"layerview_prime_tower": [0, 255, 255, 255],
|
"layerview_prime_tower": [0, 255, 255, 255],
|
||||||
|
"layerview_move_unretraction": [111, 195, 255, 255],
|
||||||
"layerview_nozzle": [224, 192, 16, 64],
|
"layerview_nozzle": [224, 192, 16, 64],
|
||||||
"layerview_starts": [255, 255, 255, 255],
|
"layerview_starts": [255, 255, 255, 255],
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user