Merge branch 'dev_native' of https://github.com/prusa3d/Slic3r into dev_native

This commit is contained in:
YuSanka 2018-11-01 13:56:20 +01:00
commit ba8a2e11b8
47 changed files with 669 additions and 2617 deletions

View File

@ -101,7 +101,7 @@ include_directories(${LIBDIR}/libslic3r ${LIBDIR}/clipper ${LIBDIR}/polypartitio
if(WIN32)
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
endif()
add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)

9
deps/CMakeLists.txt vendored
View File

@ -48,7 +48,14 @@ else ()
endif()
add_custom_target(deps ALL
DEPENDS dep_boost dep_tbb dep_libcurl dep_wxwidgets
DEPENDS
dep_boost
dep_tbb
dep_libcurl
dep_wxwidgets
dep_gtest
dep_nlopt
dep_libpng
)
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands

View File

@ -63,7 +63,6 @@ ExternalProject_Add(dep_zlib
INSTALL_COMMAND ""
)
ExternalProject_Add(dep_libpng
DEPENDS dep_zlib
EXCLUDE_FROM_ALL 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1,3 +1,5 @@
min_slic3r_version = 1.42.0-alpha
0.4.0-alpha2 First SLA profiles
min_slic3r_version = 1.41.0-alpha
0.2.2 Edited MMU2 Single mode purge line
0.2.1 Added PET and BVOH settings for MMU2

View File

@ -5,7 +5,7 @@
name = Prusa Research
# Configuration version of this file. Config file will only be installed, if the config_version differs.
# This means, the server may force the Slic3r configuration to be downgraded.
config_version = 0.2.2
config_version = 0.4.0-alpha2
# Where to get the updates from?
config_update_url = https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/PrusaResearch/
@ -35,6 +35,14 @@ variants = 0.4
name = Original Prusa i3 MK2/S MMU 1.0
variants = 0.4; 0.6
[printer_model:MK2.5MMU2]
name = Original Prusa i3 MK2.5 MMU 2.0
variants = 0.4
[printer_model:SL1]
name = Original Prusa SL1
variants = default; dummy
# All presets starting with asterisk, for example *common*, are intermediate and they will
# not make it into the user interface.
@ -181,7 +189,6 @@ support_material_interface_spacing = 0.1
support_material_synchronize_layers = 1
support_material_threshold = 80
support_material_with_sheath = 1
wipe_tower = 1
# XXXXXXXXXXXXXXXXXXXX
# XXX--- 0.05mm ---XXX
@ -329,7 +336,7 @@ top_solid_layers = 7
[print:0.15mm 100mms Linear Advance]
inherits = *0.15mm*
bridge_flow_ratio = 0.95
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4
external_perimeter_speed = 50
infill_speed = 100
max_print_speed = 150
@ -341,7 +348,7 @@ top_solid_infill_speed = 70
[print:0.15mm OPTIMAL]
inherits = *0.15mm*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4
top_infill_extrusion_width = 0.45
[print:0.15mm OPTIMAL 0.25 nozzle]
@ -374,16 +381,33 @@ perimeter_speed = 45
solid_infill_speed = 200
top_solid_infill_speed = 50
[print:0.15mm OPTIMAL MK3 SOLUBLE FULL]
inherits = 0.15mm OPTIMAL MK3; *soluble_support*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
notes = Set your solluble extruder in Multiple Extruders > Support material/raft/skirt extruder & Support material/raft interface extruder
support_material_extruder = 5
support_material_interface_extruder = 5
perimeter_speed = 40
solid_infill_speed = 40
top_infill_extrusion_width = 0.45
top_solid_infill_speed = 30
[print:0.15mm OPTIMAL MK3 SOLUBLE INTERFACE]
inherits = 0.15mm OPTIMAL MK3 SOLUBLE FULL
notes = Set your solluble extruder in Multiple Extruders > Support material/raft interface extruder
support_material_extruder = 0
support_material_interface_layers = 3
support_material_with_sheath = 0
[print:0.15mm OPTIMAL SOLUBLE FULL]
inherits = *0.15mm*; *soluble_support*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4 and num_extruders>1
external_perimeter_speed = 25
notes = Set your solluble extruder in Multiple Extruders > Support material/raft/skirt extruder & Support material/raft interface extruder
perimeter_speed = 40
solid_infill_speed = 40
top_infill_extrusion_width = 0.45
top_solid_infill_speed = 30
wipe_tower = 1
[print:0.15mm OPTIMAL SOLUBLE INTERFACE]
inherits = 0.15mm OPTIMAL SOLUBLE FULL
@ -404,6 +428,7 @@ max_print_speed = 200
perimeter_speed = 45
solid_infill_speed = 200
top_solid_infill_speed = 50
[print:*0.20mm*]
inherits = *common*
bottom_solid_layers = 4
@ -436,7 +461,7 @@ top_solid_infill_speed = 50
[print:0.20mm 100mms Linear Advance]
inherits = *0.20mm*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4
external_perimeter_speed = 50
infill_speed = 100
max_print_speed = 150
@ -458,9 +483,27 @@ perimeter_speed = 45
solid_infill_speed = 200
top_solid_infill_speed = 50
[print:0.20mm FAST MK3 SOLUBLE FULL]
inherits = 0.20mm FAST MK3; *soluble_support*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
notes = Set your solluble extruder in Multiple Extruders > Support material/raft/skirt extruder & Support material/raft interface extruder
support_material_extruder = 5
support_material_interface_extruder = 5
perimeter_speed = 40
solid_infill_speed = 40
top_infill_extrusion_width = 0.45
top_solid_infill_speed = 30
[print:0.20mm FAST MK3 SOLUBLE INTERFACE]
inherits = 0.20mm FAST MK3 SOLUBLE FULL
notes = Set your solluble extruder in Multiple Extruders > Support material/raft interface extruder
support_material_extruder = 0
support_material_interface_layers = 3
support_material_with_sheath = 0
[print:0.20mm NORMAL]
inherits = *0.20mm*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4
[print:0.20mm NORMAL 0.6 nozzle]
inherits = *0.20mm*; *0.6nozzle*
@ -468,7 +511,7 @@ compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and
[print:0.20mm NORMAL SOLUBLE FULL]
inherits = *0.20mm*; *soluble_support*
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4 and num_extruders>1
external_perimeter_speed = 30
notes = Set your solluble extruder in Multiple Extruders > Support material/raft/skirt extruder & Support material/raft interface extruder
perimeter_speed = 40
@ -519,7 +562,7 @@ top_solid_layers = 4
[print:0.35mm FAST]
inherits = *0.35mm*
bridge_flow_ratio = 0.95
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.4
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2[^\.].*/ and nozzle_diameter[0]==0.4
first_layer_extrusion_width = 0.42
perimeter_extrusion_width = 0.43
solid_infill_extrusion_width = 0.7
@ -547,6 +590,53 @@ support_material_interface_layers = 2
support_material_with_sheath = 0
support_material_xy_spacing = 150%
# XXXXXXXXXXXXXXXXXXXXXX
# XXX----- MK2.5 ----XXX
# XXXXXXXXXXXXXXXXXXXXXX
[print:0.15mm 100mms Linear Advance MK2.5]
inherits = 0.15mm 100mms Linear Advance
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4
single_extruder_multi_material_priming = 0
[print:0.15mm OPTIMAL MK2.5]
inherits = 0.15mm OPTIMAL
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4
single_extruder_multi_material_priming = 0
[print:0.15mm OPTIMAL SOLUBLE FULL MK2.5]
inherits = 0.15mm OPTIMAL SOLUBLE FULL
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
[print:0.15mm OPTIMAL SOLUBLE INTERFACE MK2.5]
inherits = 0.15mm OPTIMAL SOLUBLE INTERFACE
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
[print:0.20mm 100mms Linear Advance MK2.5]
inherits = 0.20mm 100mms Linear Advance
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4
single_extruder_multi_material_priming = 0
[print:0.20mm NORMAL MK2.5]
inherits = 0.20mm NORMAL
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4
single_extruder_multi_material_priming = 0
[print:0.20mm NORMAL SOLUBLE FULL MK2.5]
inherits = 0.20mm NORMAL SOLUBLE FULL
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
single_extruder_multi_material_priming = 0
[print:0.20mm NORMAL SOLUBLE INTERFACE MK2.5]
inherits = 0.20mm NORMAL SOLUBLE INTERFACE
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4 and num_extruders>1
single_extruder_multi_material_priming = 0
[print:0.35mm FAST MK2.5]
inherits = 0.35mm FAST
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.5.*/ and nozzle_diameter[0]==0.4
single_extruder_multi_material_priming = 0
# XXXXXXxxXXXXXXXXXXXXXX
# XXX--- filament ---XXX
# XXXXXXXXxxXXXXXXXXXXXX
@ -555,7 +645,7 @@ support_material_xy_spacing = 150%
cooling = 1
compatible_printers =
# For now, all but selected filaments are disabled for the MMU 2.0
compatible_printers_condition = ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material)
compatible_printers_condition = ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
end_filament_gcode = "; Filament-specific end gcode"
extrusion_multiplier = 1
filament_loading_speed = 28
@ -655,7 +745,7 @@ temperature = 240
[filament:ColorFabb Brass Bronze]
inherits = *PLA*
# For now, all but selected filaments are disabled for the MMU 2.0
compatible_printers_condition = nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material)
compatible_printers_condition = nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
extrusion_multiplier = 1.2
filament_cost = 80.65
filament_density = 4
@ -687,7 +777,7 @@ filament_density = 1.24
[filament:ColorFabb Woodfil]
inherits = *PLA*
# For now, all but selected filaments are disabled for the MMU 2.0
compatible_printers_condition = nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material)
compatible_printers_condition = nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
extrusion_multiplier = 1.2
filament_cost = 62.9
filament_density = 1.15
@ -789,7 +879,7 @@ temperature = 275
[filament:Fillamentum Timberfil]
inherits = *PLA*
# For now, all but selected filaments are disabled for the MMU 2.0
compatible_printers_condition = nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material)
compatible_printers_condition = nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
extrusion_multiplier = 1.2
filament_cost = 68
filament_density = 1.15
@ -851,7 +941,7 @@ filament_notes = "List of materials tested with standart ABS print settings for
[filament:*ABS MMU2*]
inherits = Prusa ABS
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material
filament_cooling_final_speed = 50
filament_cooling_initial_speed = 10
filament_cooling_moves = 5
@ -889,7 +979,7 @@ filament_notes = "List of manufacturers tested with standart PET print settings
[filament:*PET MMU2*]
inherits = Prusa PET
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material
temperature = 230
first_layer_temperature = 230
filament_cooling_final_speed = 1
@ -915,9 +1005,16 @@ filament_cost = 25.4
filament_density = 1.24
filament_notes = "List of materials tested with standart PLA print settings for MK2:\n\nDas Filament\nEsun PLA\nEUMAKERS PLA\nFiberlogy HD-PLA\nFillamentum PLA\nFloreon3D\nHatchbox PLA\nPlasty Mladeč PLA\nPrimavalue PLA\nProto pasta Matte Fiber\nVerbatim PLA\nVerbatim BVOH"
[filament:Prusament PLA]
inherits = *PLA*
temperature = 215
filament_cost = 24.99
filament_density = 1.24
filament_notes = "Affordable filament for everyday printing in premium quality manufactured in-house by Josef Prusa"
[filament:*PLA MMU2*]
inherits = Prusa PLA
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material
temperature = 205
filament_cooling_final_speed = 1
filament_cooling_initial_speed = 2
@ -934,6 +1031,9 @@ inherits = *PLA MMU2*
[filament:Prusa PLA MMU2]
inherits = *PLA MMU2*
[filament:Prusament PLA MMU2]
inherits = *PLA MMU2*
[filament:SemiFlex or Flexfill 98A]
inherits = *FLEX*
filament_cost = 82
@ -998,7 +1098,7 @@ temperature = 210
[filament:Verbatim BVOH MMU2]
inherits = Verbatim BVOH
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material
temperature = 195
filament_notes = BVOH
fan_always_on = 1
@ -1037,7 +1137,22 @@ min_fan_speed = 100
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
temperature = 220
[sla_material:*common*]
layer_height = 0.05
initial_layer_height = 0.3
exposure_time = 10
initial_exposure_time = 15
material_correction_printing = 1, 1, 1
material_correction_curing = 1, 1, 1
[sla_material:Material 1]
inherits = *common*
[sla_material:Material 2]
inherits = *common*
[printer:*common*]
printer_technology = FFF
bed_shape = 0x0,250x0,250x210,0x210
before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n
between_objects_gcode =
@ -1098,7 +1213,7 @@ z_offset = 0
printer_model = MK2S
printer_variant = 0.4
default_print_profile = 0.15mm OPTIMAL
default_filament_profile = Prusa PLA
default_filament_profile = Prusament PLA
[printer:*multimaterial*]
inherits = *common*
@ -1193,19 +1308,83 @@ default_print_profile = 0.20mm NORMAL 0.6 nozzle
inherits = Original Prusa i3 MK2
printer_model = MK2.5
remaining_times = 1
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
start_gcode = M115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
[printer:Original Prusa i3 MK2.5 MMU2 Single]
inherits = Original Prusa i3 MK2.5; *mm2*
printer_model = MK2.5MMU2
single_extruder_multi_material = 0
max_print_height = 200
remaining_times = 1
silent_mode = 0
retract_lift_below = 199
machine_max_acceleration_e = 10000
machine_max_acceleration_extruding = 2000
machine_max_acceleration_retracting = 1500
machine_max_acceleration_x = 9000
machine_max_acceleration_y = 9000
machine_max_acceleration_z = 500
machine_max_feedrate_e = 120
machine_max_feedrate_x = 500
machine_max_feedrate_y = 500
machine_max_feedrate_z = 12
machine_max_jerk_e = 2.5
machine_max_jerk_x = 10
machine_max_jerk_y = 10
machine_max_jerk_z = 0.2
machine_min_extruding_rate = 0
machine_min_travel_rate = 0
default_print_profile = 0.15mm OPTIMAL MK2.5
default_filament_profile = Prusament PLA
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_MK2.5\n
start_gcode = M107\nM115 U3.4.2 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\n\nG21 ; set units to millimeters\n\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT?\n; purge line\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
end_gcode = G1 X0 Y210 F7200\nG1 E2 F5000\nG1 E2 F5500\nG1 E2 F6000\nG1 E-15.0000 F5800\nG1 E-20.0000 F5500\nG1 E10.0000 F3000\nG1 E-10.0000 F3100\nG1 E10.0000 F3150\nG1 E-10.0000 F3250\nG1 E10.0000 F3300\n\nM702 C\n\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X0 Y200; home X axis\nM84 ; disable motors
[printer:Original Prusa i3 MK2.5 MMU2]
inherits = Original Prusa i3 MK2.5; *mm2*
printer_model = MK2.5MMU2
max_print_height = 200
remaining_times = 1
silent_mode = 0
retract_lift_below = 199
machine_max_acceleration_e = 10000
machine_max_acceleration_extruding = 2000
machine_max_acceleration_retracting = 1500
machine_max_acceleration_x = 9000
machine_max_acceleration_y = 9000
machine_max_acceleration_z = 500
machine_max_feedrate_e = 120
machine_max_feedrate_x = 500
machine_max_feedrate_y = 500
machine_max_feedrate_z = 12
machine_max_jerk_e = 2.5
machine_max_jerk_x = 10
machine_max_jerk_y = 10
machine_max_jerk_z = 0.2
machine_min_extruding_rate = 0
machine_min_travel_rate = 0
default_print_profile = 0.15mm OPTIMAL MK2.5
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_MK2.5\n
single_extruder_multi_material = 1
# The 5x nozzle diameter defines the number of extruders. Other extruder parameters
# (for example the retract values) are duplicaed from the first value, so they do not need
# to be defined explicitely.
nozzle_diameter = 0.4,0.4,0.4,0.4,0.4
extruder_colour = #FF8000;#0080FF;#00FFFF;#FF4F4F;#9FFF9F
start_gcode = M107\nM115 U3.4.2 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG21 ; set units to millimeters\n\n; Send the filament type to the MMU2.0 unit.\n; E stands for extruder number, F stands for filament type (0: default; 1:flex; 2: PVA)\nM403 E0 F{"" + ((filament_type[0]=="FLEX") ? 1 : ((filament_type[0]=="PVA") ? 2 : 0))}\nM403 E1 F{"" + ((filament_type[1]=="FLEX") ? 1 : ((filament_type[1]=="PVA") ? 2 : 0))}\nM403 E2 F{"" + ((filament_type[2]=="FLEX") ? 1 : ((filament_type[2]=="PVA") ? 2 : 0))}\nM403 E3 F{"" + ((filament_type[3]=="FLEX") ? 1 : ((filament_type[3]=="PVA") ? 2 : 0))}\nM403 E4 F{"" + ((filament_type[4]=="FLEX") ? 1 : ((filament_type[4]=="PVA") ? 2 : 0))}\n\n{if not has_single_extruder_multi_material_priming}\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT[initial_tool]\n; initial load\nG1 X55.0 E32.0 F1073.0\nG1 X5.0 E32.0 F1800.0\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\nG92 E0.0\n{endif}\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
end_gcode = {if has_wipe_tower}\nG1 E-15.0000 F3000\n{else}\nG1 X0 Y210 F7200\nG1 E2 F5000\nG1 E2 F5500\nG1 E2 F6000\nG1 E-15.0000 F5800\nG1 E-20.0000 F5500\nG1 E10.0000 F3000\nG1 E-10.0000 F3100\nG1 E10.0000 F3150\nG1 E-10.0000 F3250\nG1 E10.0000 F3300\n{endif}\n\n; Unload filament\nM702 C\n\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\n; Lift print head a bit\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up\nG1 X0 Y200; home X axis\nM84 ; disable motors\n
[printer:Original Prusa i3 MK2.5 0.25 nozzle]
inherits = Original Prusa i3 MK2 0.25 nozzle
printer_model = MK2.5
remaining_times = 1
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
start_gcode = M115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
[printer:Original Prusa i3 MK2.5 0.6 nozzle]
inherits = Original Prusa i3 MK2 0.6 nozzle
printer_model = MK2.5
remaining_times = 1
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
start_gcode = M115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0
# XXXXXXXXXXXXXXXXX
# XXX--- MK3 ---XXX
@ -1221,8 +1400,8 @@ machine_max_acceleration_x = 1000,960
machine_max_acceleration_y = 1000,960
machine_max_acceleration_z = 1000,1000
machine_max_feedrate_e = 120,120
machine_max_feedrate_x = 200,172
machine_max_feedrate_y = 200,172
machine_max_feedrate_x = 200,100
machine_max_feedrate_y = 200,100
machine_max_feedrate_z = 12,12
machine_max_jerk_e = 1.5,1.5
machine_max_jerk_x = 8,8
@ -1235,7 +1414,7 @@ remaining_times = 1
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_MK3\n
retract_lift_below = 209
max_print_height = 210
start_gcode = M115 U3.3.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0\nM221 S{if layer_height==0.05}100{else}95{endif}
start_gcode = M115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0\nM221 S{if layer_height==0.05}100{else}95{endif}
printer_model = MK3
default_print_profile = 0.15mm OPTIMAL MK3
@ -1265,11 +1444,12 @@ retract_length_toolchange = 3
extra_loading_move = -13
printer_model = MK3MMU2
default_print_profile = 0.15mm OPTIMAL MK3
default_filament_profile = Prusa PLA MMU2
default_filament_profile = Prusament PLA MMU2
[printer:Original Prusa i3 MK3 MMU2 Single]
inherits = *mm2*
start_gcode = M107\nM115 U3.4.0-RC2 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\n\nG21 ; set units to millimeters\n\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT?\n; purge line\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
single_extruder_multi_material = 0
start_gcode = M107\nM115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\n\nG21 ; set units to millimeters\n\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT?\n; purge line\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
end_gcode = G1 X0 Y210 F7200\nG1 E2 F5000\nG1 E2 F5500\nG1 E2 F6000\nG1 E-15.0000 F5800\nG1 E-20.0000 F5500\nG1 E10.0000 F3000\nG1 E-10.0000 F3100\nG1 E10.0000 F3150\nG1 E-10.0000 F3250\nG1 E10.0000 F3300\n\nM702 C\n\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X0 Y200; home X axis\nM84 ; disable motors
[printer:Original Prusa i3 MK3 MMU2]
@ -1280,9 +1460,27 @@ inherits = *mm2*
machine_max_acceleration_e = 8000,8000
nozzle_diameter = 0.4,0.4,0.4,0.4,0.4
extruder_colour = #FF8000;#0080FF;#00FFFF;#FF4F4F;#9FFF9F
start_gcode = M107\nM115 U3.4.0-RC2 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG21 ; set units to millimeters\n\n; Send the filament type to the MMU2.0 unit.\n; E stands for extruder number, F stands for filament type (0: default; 1:flex; 2: PVA)\nM403 E0 F{"" + ((filament_type[0]=="FLEX") ? 1 : ((filament_type[0]=="PVA") ? 2 : 0))}\nM403 E1 F{"" + ((filament_type[1]=="FLEX") ? 1 : ((filament_type[1]=="PVA") ? 2 : 0))}\nM403 E2 F{"" + ((filament_type[2]=="FLEX") ? 1 : ((filament_type[2]=="PVA") ? 2 : 0))}\nM403 E3 F{"" + ((filament_type[3]=="FLEX") ? 1 : ((filament_type[3]=="PVA") ? 2 : 0))}\nM403 E4 F{"" + ((filament_type[4]=="FLEX") ? 1 : ((filament_type[4]=="PVA") ? 2 : 0))}\n\n{if not has_single_extruder_multi_material_priming}\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT[initial_tool]\n; initial load\nG1 X55.0 E32.0 F1073.0\nG1 X5.0 E32.0 F1800.0\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\nG92 E0.0\n{endif}\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
start_gcode = M107\nM115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG21 ; set units to millimeters\n\n; Send the filament type to the MMU2.0 unit.\n; E stands for extruder number, F stands for filament type (0: default; 1:flex; 2: PVA)\nM403 E0 F{"" + ((filament_type[0]=="FLEX") ? 1 : ((filament_type[0]=="PVA") ? 2 : 0))}\nM403 E1 F{"" + ((filament_type[1]=="FLEX") ? 1 : ((filament_type[1]=="PVA") ? 2 : 0))}\nM403 E2 F{"" + ((filament_type[2]=="FLEX") ? 1 : ((filament_type[2]=="PVA") ? 2 : 0))}\nM403 E3 F{"" + ((filament_type[3]=="FLEX") ? 1 : ((filament_type[3]=="PVA") ? 2 : 0))}\nM403 E4 F{"" + ((filament_type[4]=="FLEX") ? 1 : ((filament_type[4]=="PVA") ? 2 : 0))}\n\n{if not has_single_extruder_multi_material_priming}\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT[initial_tool]\n; initial load\nG1 X55.0 E32.0 F1073.0\nG1 X5.0 E32.0 F1800.0\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\nG92 E0.0\n{endif}\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
end_gcode = {if has_wipe_tower}\nG1 E-15.0000 F3000\n{else}\nG1 X0 Y210 F7200\nG1 E2 F5000\nG1 E2 F5500\nG1 E2 F6000\nG1 E-15.0000 F5800\nG1 E-20.0000 F5500\nG1 E10.0000 F3000\nG1 E-10.0000 F3100\nG1 E10.0000 F3150\nG1 E-10.0000 F3250\nG1 E10.0000 F3300\n{endif}\n\n; Unload filament\nM702 C\n\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\n; Lift print head a bit\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up\nG1 X0 Y200; home X axis\nM84 ; disable motors\n
[printer:Original Prusa SL1]
printer_technology = SLA
printer_model = SL1
printer_variant = default
default_sla_material_profile = Material 1
bed_shape = 0x0,150x0,150x100,0x100
max_print_height = 100
display_width = 150
display_height = 100
display_pixels_x = 2000
display_pixels_y = 1000
printer_correction = 1,1,1
[printer:Original Prusa SL1 dummy]
inherits = Original Prusa SL1
printer_variant = dummy
default_sla_material_profile = Material 2
# The obsolete presets will be removed when upgrading from the legacy configuration structure (up to Slic3r 1.39.2) to 1.40.0 and newer.
[obsolete_presets]
print="0.05mm DETAIL 0.25 nozzle";"0.05mm DETAIL MK3";"0.05mm DETAIL";"0.20mm NORMAL MK3";"0.35mm FAST MK3";"print:0.15mm OPTIMAL MK3 MMU2";"print:0.20mm FAST MK3 MMU2"

View File

@ -76,7 +76,7 @@
{
"path": ".",
// "folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
"file_exclude_patterns": ["XS.c"]
"file_exclude_patterns": ["XS.c", "*.pch", "*.ilk", "*.js" ]
}
],

View File

@ -1276,8 +1276,11 @@ public:
void read_cli(const std::vector<std::string> &tokens, t_config_option_keys* extra);
bool read_cli(int argc, char** argv, t_config_option_keys* extra);
private:
typedef std::map<t_config_option_key,ConfigOption*> t_options_map;
t_options_map::const_iterator cbegin() const { return options.cbegin(); }
t_options_map::const_iterator cend() const { return options.cend(); }
private:
t_options_map options;
};

View File

@ -1329,11 +1329,18 @@ namespace Slic3r {
void _3MF_Importer::_apply_transform(ModelInstance& instance, const Transform3d& transform)
{
#if ENABLE_MODELVOLUME_TRANSFORM
Slic3r::Geometry::Transformation t(transform);
// invalid scale value, return
if (!t.get_scaling_factor().all())
return;
instance.set_transformation(t);
#else
// translation
Vec3d offset = transform.matrix().block(0, 3, 3, 1);
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> m3x3 = transform.matrix().block(0, 0, 3, 3);
#if ENABLE_MIRROR
// mirror
// it is impossible to reconstruct the original mirroring factors from a matrix,
// we can only detect if the matrix contains a left handed reference system
@ -1347,7 +1354,6 @@ namespace Slic3r {
}
// scale
#endif // ENABLE_MIRROR
Vec3d scale(m3x3.col(0).norm(), m3x3.col(1).norm(), m3x3.col(2).norm());
// invalid scale value, return
@ -1364,9 +1370,8 @@ namespace Slic3r {
instance.set_offset(offset);
instance.set_scaling_factor(scale);
instance.set_rotation(rotation);
#if ENABLE_MIRROR
instance.set_mirror(mirror);
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
}
bool _3MF_Importer::_handle_start_config(const char** attributes, unsigned int num_attributes)

View File

@ -32,9 +32,7 @@
// 2 : Added z component of offset
// Added x and y components of rotation
// Added x, y and z components of scale
#if ENABLE_MIRROR
// Added x, y and z components of mirror
#endif // ENABLE_MIRROR
const unsigned int VERSION_AMF = 2;
const char* SLIC3RPE_AMF_VERSION = "slic3rpe_amf_version";
@ -132,24 +130,18 @@ struct AMFParserContext
NODE_TYPE_SCALEX, // amf/constellation/instance/scalex
NODE_TYPE_SCALEY, // amf/constellation/instance/scaley
NODE_TYPE_SCALEZ, // amf/constellation/instance/scalez
#if ENABLE_MIRROR
NODE_TYPE_MIRRORX, // amf/constellation/instance/mirrorx
NODE_TYPE_MIRRORY, // amf/constellation/instance/mirrory
NODE_TYPE_MIRRORZ, // amf/constellation/instance/mirrorz
#endif // ENABLE_MIRROR
NODE_TYPE_METADATA, // anywhere under amf/*/metadata
};
struct Instance {
#if ENABLE_MIRROR
Instance()
: deltax_set(false), deltay_set(false), deltaz_set(false)
, rx_set(false), ry_set(false), rz_set(false)
, scalex_set(false), scaley_set(false), scalez_set(false)
, mirrorx_set(false), mirrory_set(false), mirrorz_set(false) {}
#else
Instance() : deltax_set(false), deltay_set(false), deltaz_set(false), rx_set(false), ry_set(false), rz_set(false), scalex_set(false), scaley_set(false), scalez_set(false) {}
#endif // ENABLE_MIRROR
// Shift in the X axis.
float deltax;
bool deltax_set;
@ -175,7 +167,6 @@ struct AMFParserContext
bool scaley_set;
float scalez;
bool scalez_set;
#if ENABLE_MIRROR
// Mirroring factors
float mirrorx;
bool mirrorx_set;
@ -183,7 +174,6 @@ struct AMFParserContext
bool mirrory_set;
float mirrorz;
bool mirrorz_set;
#endif // ENABLE_MIRROR
};
struct Object {
@ -314,14 +304,12 @@ void AMFParserContext::startElement(const char *name, const char **atts)
node_type_new = NODE_TYPE_SCALEZ;
else if (strcmp(name, "scale") == 0)
node_type_new = NODE_TYPE_SCALE;
#if ENABLE_MIRROR
else if (strcmp(name, "mirrorx") == 0)
node_type_new = NODE_TYPE_MIRRORX;
else if (strcmp(name, "mirrory") == 0)
node_type_new = NODE_TYPE_MIRRORY;
else if (strcmp(name, "mirrorz") == 0)
node_type_new = NODE_TYPE_MIRRORZ;
#endif // ENABLE_MIRROR
}
break;
case 4:
@ -387,14 +375,10 @@ void AMFParserContext::characters(const XML_Char *s, int len)
m_path.back() == NODE_TYPE_SCALEX ||
m_path.back() == NODE_TYPE_SCALEY ||
m_path.back() == NODE_TYPE_SCALEZ ||
#if ENABLE_MIRROR
m_path.back() == NODE_TYPE_SCALE ||
m_path.back() == NODE_TYPE_MIRRORX ||
m_path.back() == NODE_TYPE_MIRRORY ||
m_path.back() == NODE_TYPE_MIRRORZ)
#else
m_path.back() == NODE_TYPE_SCALE)
#endif // ENABLE_MIRROR
m_value[0].append(s, len);
break;
case 6:
@ -486,7 +470,6 @@ void AMFParserContext::endElement(const char * /* name */)
m_instance->scalez_set = true;
m_value[0].clear();
break;
#if ENABLE_MIRROR
case NODE_TYPE_MIRRORX:
assert(m_instance);
m_instance->mirrorx = float(atof(m_value[0].c_str()));
@ -505,7 +488,6 @@ void AMFParserContext::endElement(const char * /* name */)
m_instance->mirrorz_set = true;
m_value[0].clear();
break;
#endif // ENABLE_MIRROR
// Object vertices:
case NODE_TYPE_VERTEX:
@ -665,9 +647,7 @@ void AMFParserContext::endDocument()
mi->set_offset(Vec3d(instance.deltax_set ? (double)instance.deltax : 0.0, instance.deltay_set ? (double)instance.deltay : 0.0, instance.deltaz_set ? (double)instance.deltaz : 0.0));
mi->set_rotation(Vec3d(instance.rx_set ? (double)instance.rx : 0.0, instance.ry_set ? (double)instance.ry : 0.0, instance.rz_set ? (double)instance.rz : 0.0));
mi->set_scaling_factor(Vec3d(instance.scalex_set ? (double)instance.scalex : 1.0, instance.scaley_set ? (double)instance.scaley : 1.0, instance.scalez_set ? (double)instance.scalez : 1.0));
#if ENABLE_MIRROR
mi->set_mirror(Vec3d(instance.mirrorx_set ? (double)instance.mirrorx : 1.0, instance.mirrory_set ? (double)instance.mirrory : 1.0, instance.mirrorz_set ? (double)instance.mirrorz : 1.0));
#endif // ENABLE_MIRROR
}
}
}
@ -987,11 +967,9 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c
" <scalex>%lf</scalex>\n"
" <scaley>%lf</scaley>\n"
" <scalez>%lf</scalez>\n"
#if ENABLE_MIRROR
" <mirrorx>%lf</mirrorx>\n"
" <mirrory>%lf</mirrory>\n"
" <mirrorz>%lf</mirrorz>\n"
#endif // ENABLE_MIRROR
" </instance>\n",
object_id,
instance->get_offset(X),
@ -1002,14 +980,10 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c
instance->get_rotation(Z),
instance->get_scaling_factor(X),
instance->get_scaling_factor(Y),
#if ENABLE_MIRROR
instance->get_scaling_factor(Z),
instance->get_mirror(X),
instance->get_mirror(Y),
instance->get_mirror(Z));
#else
instance->get_scaling_factor(Z));
#endif // ENABLE_MIRROR
//FIXME missing instance->scaling_factor
instances.append(buf);

View File

@ -1652,8 +1652,8 @@ void GCode::append_full_config(const Print& print, std::string& str)
}
const DynamicConfig &full_config = print.placeholder_parser().config();
for (const char *key : {
"print_settings_id", "filament_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile",
"print_settings_id", "filament_settings_id", "sla_material_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_material_profile",
"compatible_printers_condition_cummulative", "inherits_cummulative" }) {
const ConfigOption *opt = full_config.option(key);
if (opt != nullptr)

View File

@ -1161,11 +1161,7 @@ MedialAxis::retrieve_endpoint(const VD::cell_type* cell) const
}
}
#if ENABLE_MIRROR
void assemble_transform(Transform3d& transform, const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale, const Vec3d& mirror)
#else
void assemble_transform(Transform3d& transform, const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale)
#endif // ENABLE_MIRROR
{
transform = Transform3d::Identity();
transform.translate(translation);
@ -1173,23 +1169,13 @@ void assemble_transform(Transform3d& transform, const Vec3d& translation, const
transform.rotate(Eigen::AngleAxisd(rotation(1), Vec3d::UnitY()));
transform.rotate(Eigen::AngleAxisd(rotation(0), Vec3d::UnitX()));
transform.scale(scale);
#if ENABLE_MIRROR
transform.scale(mirror);
#endif // ENABLE_MIRROR
}
#if ENABLE_MIRROR
Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale, const Vec3d& mirror)
#else
Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale)
#endif // ENABLE_MIRROR
{
Transform3d transform;
#if ENABLE_MIRROR
assemble_transform(transform, translation, rotation, scale, mirror);
#else
assemble_transform(transform, translation, rotation, scale);
#endif // ENABLE_MIRROR
return transform;
}
@ -1232,13 +1218,10 @@ Transformation::Flags::Flags()
: dont_translate(true)
, dont_rotate(true)
, dont_scale(true)
#if ENABLE_MIRROR
, dont_mirror(true)
#endif // ENABLE_MIRROR
{
}
#if ENABLE_MIRROR
bool Transformation::Flags::needs_update(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
{
return (this->dont_translate != dont_translate) || (this->dont_rotate != dont_rotate) || (this->dont_scale != dont_scale) || (this->dont_mirror != dont_mirror);
@ -1251,32 +1234,22 @@ void Transformation::Flags::set(bool dont_translate, bool dont_rotate, bool dont
this->dont_scale = dont_scale;
this->dont_mirror = dont_mirror;
}
#else
bool Transformation::Flags::needs_update(bool dont_translate, bool dont_rotate, bool dont_scale) const
{
return (this->dont_translate != dont_translate) || (this->dont_rotate != dont_rotate) || (this->dont_scale != dont_scale);
}
void Transformation::Flags::set(bool dont_translate, bool dont_rotate, bool dont_scale)
{
this->dont_translate = dont_translate;
this->dont_rotate = dont_rotate;
this->dont_scale = dont_scale;
}
#endif // ENABLE_MIRROR
Transformation::Transformation()
: m_offset(Vec3d::Zero())
, m_rotation(Vec3d::Zero())
, m_scaling_factor(Vec3d::Ones())
#if ENABLE_MIRROR
, m_mirror(Vec3d::Ones())
#endif // ENABLE_MIRROR
, m_matrix(Transform3d::Identity())
, m_dirty(false)
{
}
Transformation::Transformation(const Transform3d& transform)
{
set_from_transform(transform);
}
void Transformation::set_offset(const Vec3d& offset)
{
set_offset(X, offset(0));
@ -1304,7 +1277,7 @@ void Transformation::set_rotation(Axis axis, double rotation)
{
rotation = angle_to_0_2PI(rotation);
if (m_rotation(axis) = rotation)
if (m_rotation(axis) != rotation)
{
m_rotation(axis) = rotation;
m_dirty = true;
@ -1349,39 +1322,67 @@ void Transformation::set_mirror(Axis axis, double mirror)
}
}
#if ENABLE_MIRROR
const Transform3d& Transformation::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
#else
const Transform3d& Transformation::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale) const
#endif // ENABLE_MIRROR
void Transformation::set_from_transform(const Transform3d& transform)
{
#if ENABLE_MIRROR
if (m_dirty || m_flags.needs_update(dont_translate, dont_rotate, dont_scale, dont_mirror))
#else
if (m_dirty || m_flags.needs_update(dont_translate, dont_rotate, dont_scale))
#endif // ENABLE_MIRROR
{
Vec3d translation = dont_translate ? Vec3d::Zero() : m_offset;
Vec3d rotation = dont_rotate ? Vec3d::Zero() : m_rotation;
Vec3d scale = dont_scale ? Vec3d::Ones() : m_scaling_factor;
#if ENABLE_MIRROR
Vec3d mirror = dont_mirror ? Vec3d::Ones() : m_mirror;
m_matrix = Geometry::assemble_transform(translation, rotation, scale, mirror);
#else
m_matrix = Geometry::assemble_transform(translation, rotation, scale);
#endif // ENABLE_MIRROR
// offset
set_offset(transform.matrix().block(0, 3, 3, 1));
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> m3x3 = transform.matrix().block(0, 0, 3, 3);
// mirror
// it is impossible to reconstruct the original mirroring factors from a matrix,
// we can only detect if the matrix contains a left handed reference system
// in which case we reorient it back to right handed by mirroring the x axis
Vec3d mirror = Vec3d::Ones();
if (m3x3.col(0).dot(m3x3.col(1).cross(m3x3.col(2))) < 0.0)
{
mirror(0) = -1.0;
// remove mirror
m3x3.col(0) *= -1.0;
}
set_mirror(mirror);
// scale
set_scaling_factor(Vec3d(m3x3.col(0).norm(), m3x3.col(1).norm(), m3x3.col(2).norm()));
// remove scale
m3x3.col(0).normalize();
m3x3.col(1).normalize();
m3x3.col(2).normalize();
// rotation
set_rotation(extract_euler_angles(m3x3));
// forces matrix recalculation matrix
m_matrix = get_matrix();
// // debug check
// if (!m_matrix.isApprox(transform))
// std::cout << "something went wrong in extracting data from matrix" << std::endl;
}
const Transform3d& Transformation::get_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
{
if (m_dirty || m_flags.needs_update(dont_translate, dont_rotate, dont_scale, dont_mirror))
{
m_matrix = Geometry::assemble_transform(
dont_translate ? Vec3d::Zero() : m_offset,
dont_rotate ? Vec3d::Zero() : m_rotation,
dont_scale ? Vec3d::Ones() : m_scaling_factor,
dont_mirror ? Vec3d::Ones() : m_mirror
);
#if ENABLE_MIRROR
m_flags.set(dont_translate, dont_rotate, dont_scale, dont_mirror);
#else
m_flags.set(dont_translate, dont_rotate, dont_scale);
#endif // ENABLE_MIRROR
m_dirty = false;
}
return m_matrix;
}
Transformation Transformation::operator * (const Transformation& other) const
{
return Transformation(get_matrix() * other.get_matrix());
}
#endif // ENABLE_MODELVOLUME_TRANSFORM
} }

View File

@ -172,7 +172,6 @@ class MedialAxis {
};
// Sets the given transform by assembling the given transformations in the following order:
#if ENABLE_MIRROR
// 1) mirror
// 2) scale
// 3) rotate X
@ -180,17 +179,8 @@ class MedialAxis {
// 5) rotate Z
// 6) translate
void assemble_transform(Transform3d& transform, const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones(), const Vec3d& mirror = Vec3d::Ones());
#else
// 1) scale
// 2) rotate X
// 3) rotate Y
// 4) rotate Z
// 5) translate
void assemble_transform(Transform3d& transform, const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones());
#endif // ENABLE_MIRROR
// Returns the transform obtained by assembling the given transformations in the following order:
#if ENABLE_MIRROR
// 1) mirror
// 2) scale
// 3) rotate X
@ -198,14 +188,6 @@ void assemble_transform(Transform3d& transform, const Vec3d& translation = Vec3d
// 5) rotate Z
// 6) translate
Transform3d assemble_transform(const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones(), const Vec3d& mirror = Vec3d::Ones());
#else
// 1) scale
// 2) rotate X
// 3) rotate Y
// 4) rotate Z
// 5) translate
Transform3d assemble_transform(const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones());
#endif // ENABLE_MIRROR
// Returns the euler angles extracted from the given rotation matrix
// Warning -> The matrix should not contain any scale or shear !!!
@ -223,34 +205,26 @@ class Transformation
bool dont_translate;
bool dont_rotate;
bool dont_scale;
#if ENABLE_MIRROR
bool dont_mirror;
#endif // ENABLE_MIRROR
Flags();
#if ENABLE_MIRROR
bool needs_update(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const;
void set(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror);
#else
bool needs_update(bool dont_translate, bool dont_rotate, bool dont_scale) const;
void set(bool dont_translate, bool dont_rotate, bool dont_scale);
#endif // ENABLE_MIRROR
};
Vec3d m_offset; // In unscaled coordinates
Vec3d m_rotation; // Rotation around the three axes, in radians around mesh center point
Vec3d m_scaling_factor; // Scaling factors along the three axes
#if ENABLE_MIRROR
Vec3d m_mirror; // Mirroring along the three axes
#endif // ENABLE_MIRROR
mutable Transform3d m_matrix;
mutable Transform3d m_matrix;
mutable Flags m_flags;
mutable bool m_dirty;
public:
Transformation();
explicit Transformation(const Transform3d& transform);
const Vec3d& get_offset() const { return m_offset; }
double get_offset(Axis axis) const { return m_offset(axis); }
@ -267,7 +241,6 @@ public:
Vec3d get_scaling_factor() const { return m_scaling_factor; }
double get_scaling_factor(Axis axis) const { return m_scaling_factor(axis); }
#if ENABLE_MIRROR
void set_scaling_factor(const Vec3d& scaling_factor);
void set_scaling_factor(Axis axis, double scaling_factor);
@ -277,13 +250,11 @@ public:
void set_mirror(const Vec3d& mirror);
void set_mirror(Axis axis, double mirror);
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const;
#else
void set_scaling_factor(const Vec3d& scaling_factor) { m_scaling_factor = scaling_factor; }
void set_scaling_factor(Axis axis, double scaling_factor) { m_scaling_factor(axis) = scaling_factor; }
void set_from_transform(const Transform3d& transform);
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false) const;
#endif // ENABLE_MIRROR
const Transform3d& get_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const;
Transformation operator * (const Transformation& other) const;
};
#endif // ENABLE_MODELVOLUME_TRANSFORM

View File

@ -693,23 +693,12 @@ void ModelObject::center_around_origin()
if (v->is_model_part())
bb.merge(v->mesh.bounding_box());
#if ENABLE_EXTENDED_SELECTION
// Shift is the vector from the center of the bounding box to the origin
Vec3d shift = -bb.center();
#else
// Shift is the vector from the center of the bottom face of the bounding box to the origin
Vec3d shift = -bb.center();
shift(2) = -bb.min(2);
#endif // ENABLE_EXTENDED_SELECTION
this->translate(shift);
this->origin_translation += shift;
#if !ENABLE_EXTENDED_SELECTION
// set z to zero, translation in z has already been done within the mesh
shift(2) = 0.0;
#endif // !ENABLE_EXTENDED_SELECTION
if (!this->instances.empty()) {
for (ModelInstance *i : this->instances) {
i->set_offset(i->get_offset() - shift);
@ -929,16 +918,16 @@ double ModelObject::get_instance_min_z(size_t instance_idx) const
double min_z = DBL_MAX;
ModelInstance* inst = instances[instance_idx];
Vec3d local_unit_z = (inst->world_matrix(true).inverse() * Vec3d::UnitZ()).normalized();
const Transform3d& m = inst->world_matrix(true);
for (ModelVolume *v : volumes)
{
for (uint32_t f = 0; f < v->mesh.stl.stats.number_of_facets; ++f)
{
const stl_facet* facet = v->mesh.stl.facet_start + f;
min_z = std::min(min_z, local_unit_z.dot(facet->vertex[0].cast<double>()));
min_z = std::min(min_z, local_unit_z.dot(facet->vertex[1].cast<double>()));
min_z = std::min(min_z, local_unit_z.dot(facet->vertex[2].cast<double>()));
min_z = std::min(min_z, Vec3d::UnitZ().dot(m * facet->vertex[0].cast<double>()));
min_z = std::min(min_z, Vec3d::UnitZ().dot(m * facet->vertex[1].cast<double>()));
min_z = std::min(min_z, Vec3d::UnitZ().dot(m * facet->vertex[2].cast<double>()));
}
}
@ -1146,7 +1135,6 @@ void ModelInstance::set_rotation(Axis axis, double rotation)
m_rotation(axis) = rotation;
}
#if ENABLE_MIRROR
void ModelInstance::set_scaling_factor(const Vec3d& scaling_factor)
{
set_scaling_factor(X, scaling_factor(0));
@ -1176,7 +1164,6 @@ void ModelInstance::set_mirror(Axis axis, double mirror)
m_mirror(axis) = mirror;
}
#endif // ENABLE_MIRROR
#endif // !ENABLE_MODELVOLUME_TRANSFORM
void ModelInstance::transform_mesh(TriangleMesh* mesh, bool dont_translate) const
@ -1188,11 +1175,7 @@ BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mes
{
// Rotate around mesh origin.
TriangleMesh copy(*mesh);
#if ENABLE_MIRROR
copy.transform(world_matrix(true, false, true, true).cast<float>());
#else
copy.transform(world_matrix(true, false, true).cast<float>());
#endif // ENABLE_MIRROR
BoundingBoxf3 bbox = copy.bounding_box();
if (!empty(bbox)) {
@ -1253,21 +1236,13 @@ void ModelInstance::transform_polygon(Polygon* polygon) const
}
#if !ENABLE_MODELVOLUME_TRANSFORM
#if ENABLE_MIRROR
Transform3d ModelInstance::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
#else
Transform3d ModelInstance::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale) const
#endif // ENABLE_MIRROR
{
Vec3d translation = dont_translate ? Vec3d::Zero() : m_offset;
Vec3d rotation = dont_rotate ? Vec3d::Zero() : m_rotation;
Vec3d scale = dont_scale ? Vec3d::Ones() : m_scaling_factor;
#if ENABLE_MIRROR
Vec3d mirror = dont_mirror ? Vec3d::Ones() : m_mirror;
return Geometry::assemble_transform(translation, rotation, scale, mirror);
#else
return Geometry::assemble_transform(translation, rotation, scale);
#endif // ENABLE_MIRROR
}
#endif // !ENABLE_MODELVOLUME_TRANSFORM

View File

@ -283,13 +283,11 @@ public:
void set_scaling_factor(const Vec3d& scaling_factor) { m_transformation.set_scaling_factor(scaling_factor); }
void set_scaling_factor(Axis axis, double scaling_factor) { m_transformation.set_scaling_factor(axis, scaling_factor); }
#if ENABLE_MIRROR
const Vec3d& get_mirror() const { return m_transformation.get_mirror(); }
double get_mirror(Axis axis) const { return m_transformation.get_mirror(axis); }
void set_mirror(const Vec3d& mirror) { m_transformation.set_mirror(mirror); }
void set_mirror(Axis axis, double mirror) { m_transformation.set_mirror(axis, mirror); }
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
private:
@ -347,9 +345,7 @@ private:
Vec3d m_offset; // in unscaled coordinates
Vec3d m_rotation; // Rotation around the three axes, in radians around mesh center point
Vec3d m_scaling_factor; // Scaling factors along the three axes
#if ENABLE_MIRROR
Vec3d m_mirror; // Mirroring along the three axes
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
public:
@ -380,13 +376,11 @@ public:
void set_scaling_factor(const Vec3d& scaling_factor) { m_transformation.set_scaling_factor(scaling_factor); }
void set_scaling_factor(Axis axis, double scaling_factor) { m_transformation.set_scaling_factor(axis, scaling_factor); }
#if ENABLE_MIRROR
const Vec3d& get_mirror() const { return m_transformation.get_mirror(); }
double get_mirror(Axis axis) const { return m_transformation.get_mirror(axis); }
void set_mirror(const Vec3d& mirror) { m_transformation.set_mirror(mirror); }
void set_mirror(Axis axis, double mirror) { m_transformation.set_mirror(axis, mirror); }
#endif // ENABLE_MIRROR
#else
const Vec3d& get_offset() const { return m_offset; }
double get_offset(Axis axis) const { return m_offset(axis); }
@ -403,21 +397,14 @@ public:
Vec3d get_scaling_factor() const { return m_scaling_factor; }
double get_scaling_factor(Axis axis) const { return m_scaling_factor(axis); }
#if ENABLE_MIRROR
void set_scaling_factor(const Vec3d& scaling_factor);
void set_scaling_factor(Axis axis, double scaling_factor);
#else
void set_scaling_factor(const Vec3d& scaling_factor) { m_scaling_factor = scaling_factor; }
void set_scaling_factor(Axis axis, double scaling_factor) { m_scaling_factor(axis) = scaling_factor; }
#endif // ENABLE_MIRROR
#if ENABLE_MIRROR
const Vec3d& get_mirror() const { return m_mirror; }
double get_mirror(Axis axis) const { return m_mirror(axis); }
void set_mirror(const Vec3d& mirror);
void set_mirror(Axis axis, double mirror);
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
// To be called on an external mesh
@ -432,17 +419,9 @@ public:
void transform_polygon(Polygon* polygon) const;
#if ENABLE_MODELVOLUME_TRANSFORM
#if ENABLE_MIRROR
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.world_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.get_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
#else
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false) const { return m_transformation.world_matrix(dont_translate, dont_rotate, dont_scale); }
#endif // ENABLE_MIRROR
#else
#if ENABLE_MIRROR
Transform3d world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const;
#else
Transform3d world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false) const;
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
bool is_printable() const { return print_volume_state == PVS_Inside; }
@ -456,15 +435,9 @@ private:
ModelInstance(ModelObject *object, const ModelInstance &other) :
m_transformation(other.m_transformation), object(object), print_volume_state(PVS_Inside) {}
#else
#if ENABLE_MIRROR
ModelInstance(ModelObject *object) : m_offset(Vec3d::Zero()), m_rotation(Vec3d::Zero()), m_scaling_factor(Vec3d::Ones()), m_mirror(Vec3d::Ones()), object(object), print_volume_state(PVS_Inside) {}
ModelInstance(ModelObject *object, const ModelInstance &other) :
m_offset(other.m_offset), m_rotation(other.m_rotation), m_scaling_factor(other.m_scaling_factor), m_mirror(other.m_mirror), object(object), print_volume_state(PVS_Inside) {}
#else
ModelInstance(ModelObject *object) : m_rotation(Vec3d::Zero()), m_scaling_factor(Vec3d::Ones()), m_offset(Vec3d::Zero()), object(object), print_volume_state(PVS_Inside) {}
ModelInstance(ModelObject *object, const ModelInstance &other) :
m_rotation(other.m_rotation), m_scaling_factor(other.m_scaling_factor), m_offset(other.m_offset), object(object), print_volume_state(PVS_Inside) {}
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
explicit ModelInstance(ModelInstance &rhs) = delete;

View File

@ -686,9 +686,11 @@ static std::vector<PrintInstances> print_objects_from_model_object(const ModelOb
trafo.copies.assign(1, Point());
for (ModelInstance *model_instance : model_object.instances)
if (model_instance->is_printable()) {
const Vec3d &offst = model_instance->get_offset();
trafo.trafo = model_instance->world_matrix(true);
trafo.copies.front() = Point::new_scale(offst(0), offst(1));
trafo.trafo = model_instance->world_matrix();
// Set the Z axis of the transformation.
trafo.copies.front() = Point::new_scale(trafo.trafo.data()[3], trafo.trafo.data()[7]);
trafo.trafo.data()[3] = 0;
trafo.trafo.data()[7] = 0;
auto it = trafos.find(trafo);
if (it == trafos.end())
trafos.emplace(trafo);
@ -977,13 +979,13 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
new_objects = true;
if (it_old != old.end())
const_cast<PrintObjectStatus*>(*it_old)->status = PrintObjectStatus::Deleted;
} else if ((*it_old)->print_object->copies() != new_instances.copies) {
} else {
// The PrintObject already exists and the copies differ.
if ((*it_old)->print_object->copies().size() != new_instances.copies.size())
update_apply_status(this->invalidate_step(psWipeTower));
if ((*it_old)->print_object->set_copies(new_instances.copies)) {
// Invalidated
update_apply_status(this->invalidate_step(psSkirt) || this->invalidate_step(psBrim) || this->invalidate_step(psGCodeExport));
update_apply_status(this->invalidate_steps({ psSkirt, psBrim, psGCodeExport }));
}
print_objects_new.emplace_back((*it_old)->print_object);
const_cast<PrintObjectStatus*>(*it_old)->status = PrintObjectStatus::Reused;
@ -1001,8 +1003,8 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
delete pos.print_object;
deleted_objects = true;
}
if (deleted_objects)
update_apply_status(this->invalidate_step(psSkirt) || this->invalidate_step(psBrim) || this->invalidate_step(psWipeTower) || this->invalidate_step(psGCodeExport));
if (new_objects || deleted_objects)
update_apply_status(this->invalidate_steps({ psSkirt, psBrim, psWipeTower, psGCodeExport }));
update_apply_status(new_objects);
}
print_object_status.clear();

View File

@ -104,6 +104,28 @@ public:
return invalidated;
}
template<typename CancelationCallback, typename StepTypeIterator>
bool invalidate_multiple(StepTypeIterator step_begin, StepTypeIterator step_end, tbb::mutex &mtx, CancelationCallback cancel) {
bool invalidated = false;
for (StepTypeIterator it = step_begin; ! invalidated && it != step_end; ++ it)
invalidated = m_state[*it].load(std::memory_order_relaxed) != INVALID;
if (invalidated) {
#if 0
if (mtx.state != mtx.HELD) {
printf("Not held!\n");
}
#endif
// Raise the mutex, so that the following cancel() callback could cancel
// the background processing.
mtx.unlock();
cancel();
for (StepTypeIterator it = step_begin; it != step_end; ++ it)
m_state[*it] = INVALID;
mtx.lock();
}
return invalidated;
}
// Make all steps invalid.
// The provided mutex should be locked at this point, guarding access to m_state.
// In case any step has already been entered or finished, cancel the background
@ -113,14 +135,16 @@ public:
bool invalidated = false;
for (size_t i = 0; i < COUNT; ++ i)
if (m_state[i].load(std::memory_order_relaxed) != INVALID) {
if (! invalidated) {
mtx.unlock();
cancel();
mtx.lock();
invalidated = true;
}
m_state[i].store(INVALID, std::memory_order_relaxed);
invalidated = true;
break;
}
if (invalidated) {
mtx.unlock();
cancel();
for (size_t i = 0; i < COUNT; ++ i)
m_state[i].store(INVALID, std::memory_order_relaxed);
mtx.lock();
}
return invalidated;
}
@ -245,7 +269,10 @@ public:
// methods for handling state
bool invalidate_state_by_config_options(const std::vector<t_config_option_key> &opt_keys);
bool invalidate_step(PrintObjectStep step);
bool invalidate_all_steps();
template<typename StepTypeIterator>
bool invalidate_steps(StepTypeIterator step_begin, StepTypeIterator step_end) { return m_state.invalidate_multiple(step_begin, step_end, this->cancel_mutex(), this->cancel_callback()); }
bool invalidate_steps(std::initializer_list<PrintObjectStep> il) { return m_state.invalidate_multiple(il.begin(), il.end(), this->cancel_mutex(), this->cancel_callback()); }
bool invalidate_all_steps() { return m_state.invalidate_all(this->cancel_mutex(), this->cancel_callback()); }
bool is_step_done(PrintObjectStep step) const { return m_state.is_done(step); }
// To be used over the layer_height_profile of both the PrintObject and ModelObject
@ -294,6 +321,9 @@ private:
void _generate_support_material();
bool is_printable() const { return ! m_copies.empty(); }
// Implemented in cpp due to cyclic dependencies between Print and PrintObject.
tbb::mutex& cancel_mutex();
std::function<void()> cancel_callback();
Print *m_print;
ModelObject *m_model_object;
@ -495,7 +525,7 @@ public:
};
CancelStatus cancel_status() const { return m_cancel_status; }
// Has the calculation been canceled?
bool canceled() const { return m_cancel_status; }
bool canceled() const { return m_cancel_status != NOT_CANCELED; }
// Cancel the running computation. Stop execution of all the background threads.
void cancel() { m_cancel_status = CANCELED_BY_USER; }
void cancel_internal() { m_cancel_status = CANCELED_INTERNAL; }
@ -509,6 +539,9 @@ protected:
void set_started(PrintStep step) { m_state.set_started(step, m_mutex); throw_if_canceled(); }
void set_done(PrintStep step) { m_state.set_done(step, m_mutex); throw_if_canceled(); }
bool invalidate_step(PrintStep step);
template<typename StepTypeIterator>
bool invalidate_steps(StepTypeIterator step_begin, StepTypeIterator step_end) { return m_state.invalidate_multiple(step_begin, step_end, m_mutex, m_cancel_callback); }
bool invalidate_steps(std::initializer_list<PrintStep> il) { return m_state.invalidate_multiple(il.begin(), il.end(), m_mutex, m_cancel_callback); }
bool invalidate_all_steps() { return m_state.invalidate_all(m_mutex, m_cancel_callback); }
// methods for handling regions

View File

@ -99,11 +99,9 @@ bool PrintObject::set_copies(const Points &points)
// Invalidate and set copies.
bool invalidated = false;
if (copies != m_copies) {
invalidated = m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
invalidated = m_print->invalidate_steps({ psSkirt, psBrim, psGCodeExport });
if (copies.size() != m_copies.size())
invalidated |= m_print->invalidate_step(psWipeTower);
invalidated |= m_print->invalidate_step(psGCodeExport);
m_copies = copies;
}
return invalidated;
@ -590,21 +588,16 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
// propagate to dependent steps
if (step == posPerimeters) {
invalidated |= this->invalidate_step(posPrepareInfill);
invalidated |= m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
invalidated |= m_print->invalidate_steps({ psSkirt, psBrim });
} else if (step == posPrepareInfill) {
invalidated |= this->invalidate_step(posInfill);
} else if (step == posInfill) {
invalidated |= m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
invalidated |= m_print->invalidate_steps({ psSkirt, psBrim });
} else if (step == posSlice) {
invalidated |= this->invalidate_step(posPerimeters);
invalidated |= this->invalidate_step(posSupportMaterial);
invalidated |= this->invalidate_steps({ posPerimeters, posSupportMaterial });
invalidated |= m_print->invalidate_step(psWipeTower);
} else if (step == posSupportMaterial) {
invalidated |= m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
}
} else if (step == posSupportMaterial)
invalidated |= m_print->invalidate_steps({ psSkirt, psBrim });
// Wipe tower depends on the ordering of extruders, which in turn depends on everything.
// It also decides about what the wipe_into_infill / wipe_into_object features will do,
@ -613,11 +606,6 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
return invalidated;
}
bool PrintObject::invalidate_all_steps()
{
return m_state.invalidate_all(m_print->m_mutex, m_print->m_cancel_callback);
}
bool PrintObject::has_support_material() const
{
return m_config.support_material
@ -1616,8 +1604,8 @@ std::vector<ExPolygons> PrintObject::_slice_volumes(const std::vector<float> &z,
mesh.merge(v->mesh);
if (mesh.stl.stats.number_of_facets > 0) {
mesh.transform(m_trafo.cast<float>());
// align mesh to Z = 0 (it should be already aligned actually) and apply XY shift
mesh.translate(- unscale<float>(m_copies_shift(0)), - unscale<float>(m_copies_shift(1)), - float(this->model_object()->bounding_box().min(2)));
// apply XY shift
mesh.translate(- unscale<float>(m_copies_shift(0)), - unscale<float>(m_copies_shift(1)), 0);
// perform actual slicing
TriangleMeshSlicer mslicer;
const Print *print = this->print();
@ -2254,4 +2242,15 @@ void PrintObject::adjust_layer_height_profile(coordf_t z, coordf_t layer_thickne
layer_height_profile_valid = false;
}
tbb::mutex& PrintObject::cancel_mutex()
{
return m_print->m_mutex;
}
std::function<void()> PrintObject::cancel_callback()
{
return m_print->m_cancel_callback;
}
} // namespace Slic3r

View File

@ -1,27 +1,24 @@
#ifndef _technologies_h_
#define _technologies_h_
//==============
//============
// debug techs
//==============
//============
// Shows camera target in the 3D scene
#define ENABLE_SHOW_CAMERA_TARGET 1
//==============
//=============
// 1.42.0 techs
//==============
//=============
#define ENABLE_1_42_0 1
// Add double click on gizmo grabbers to reset transformation components to their default value
#define ENABLE_GIZMOS_RESET (1 && ENABLE_1_42_0)
// Uses a unique opengl context
#define ENABLE_USE_UNIQUE_GLCONTEXT (1 && ENABLE_1_42_0)
// New selections
#define ENABLE_EXTENDED_SELECTION (1 && ENABLE_1_42_0)
#define DISABLE_INSTANCES_SYNCH (1 && ENABLE_EXTENDED_SELECTION)
// Add mirror components along the three axes in ModelInstance and GLVolume
#define ENABLE_MIRROR (1 && ENABLE_1_42_0)
// Disable synchronization of unselected instances
#define DISABLE_INSTANCES_SYNCH (1 && ENABLE_1_42_0)
// Modified camera target behavior
#define ENABLE_MODIFIED_CAMERA_TARGET (1 && ENABLE_1_42_0)
// Add Geometry::Transformation class and use it into ModelInstance, ModelVolume and GLVolume

View File

@ -406,7 +406,7 @@ const Snapshot& SnapshotDB::take_snapshot(const AppConfig &app_config, Snapshot:
cfg.version.min_slic3r_version = it->min_slic3r_version;
cfg.version.max_slic3r_version = it->max_slic3r_version;
}
} catch (const std::runtime_error &err) {
} catch (const std::runtime_error & /* err */) {
}
snapshot.vendor_configs.emplace_back(std::move(cfg));
}
@ -521,7 +521,7 @@ SnapshotDB& SnapshotDB::singleton()
// Update the min / max slic3r versions compatible with the configurations stored inside the snapshots
// based on the min / max slic3r versions defined by the vendor specific config indices.
instance.update_slic3r_versions(index_db);
} catch (std::exception &ex) {
} catch (std::exception & /* ex */) {
}
}
return instance;

View File

@ -201,9 +201,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
: m_offset(Vec3d::Zero())
, m_rotation(Vec3d::Zero())
, m_scaling_factor(Vec3d::Ones())
#if ENABLE_MIRROR
, m_mirror(Vec3d::Ones())
#endif // ENABLE_MIRROR
, m_world_matrix(Transform3f::Identity())
, m_world_matrix_dirty(true)
, m_transformed_bounding_box_dirty(true)
@ -211,10 +209,6 @@ GLVolume::GLVolume(float r, float g, float b, float a)
, m_transformed_convex_hull_bounding_box_dirty(true)
, m_convex_hull(nullptr)
, composite_id(-1)
#if !ENABLE_EXTENDED_SELECTION
, select_group_id(-1)
, drag_group_id(-1)
#endif // !ENABLE_EXTENDED_SELECTION
, extruder_id(0)
, selected(false)
, is_active(true)
@ -272,14 +266,11 @@ const Vec3d& GLVolume::get_rotation() const
void GLVolume::set_rotation(const Vec3d& rotation)
{
#if ENABLE_EXTENDED_SELECTION
static const double TWO_PI = 2.0 * (double)PI;
#endif // ENABLE_EXTENDED_SELECTION
if (m_rotation != rotation)
{
m_rotation = rotation;
#if ENABLE_EXTENDED_SELECTION
for (int i = 0; i < 3; ++i)
{
while (m_rotation(i) < 0.0)
@ -291,7 +282,6 @@ void GLVolume::set_rotation(const Vec3d& rotation)
m_rotation(i) -= TWO_PI;
}
}
#endif // ENABLE_EXTENDED_SELECTION
m_world_matrix_dirty = true;
m_transformed_bounding_box_dirty = true;
m_transformed_convex_hull_bounding_box_dirty = true;
@ -314,12 +304,10 @@ void GLVolume::set_offset(const Vec3d& offset)
}
}
#if ENABLE_EXTENDED_SELECTION
const Vec3d& GLVolume::get_scaling_factor() const
{
return m_scaling_factor;
}
#endif // ENABLE_EXTENDED_SELECTION
void GLVolume::set_scaling_factor(const Vec3d& scaling_factor)
{
@ -332,7 +320,6 @@ void GLVolume::set_scaling_factor(const Vec3d& scaling_factor)
}
}
#if ENABLE_MIRROR
const Vec3d& GLVolume::get_mirror() const
{
return m_mirror;
@ -364,7 +351,6 @@ void GLVolume::set_mirror(Axis axis, double mirror)
m_transformed_convex_hull_bounding_box_dirty = true;
}
}
#endif // ENABLE_MIRROR
#endif // !ENABLE_MODELVOLUME_TRANSFORM
void GLVolume::set_convex_hull(const TriangleMesh& convex_hull)
@ -372,36 +358,12 @@ void GLVolume::set_convex_hull(const TriangleMesh& convex_hull)
m_convex_hull = &convex_hull;
}
#if !ENABLE_EXTENDED_SELECTION
void GLVolume::set_select_group_id(const std::string& select_by)
{
if (select_by == "object")
select_group_id = object_idx() * 1000000;
else if (select_by == "volume")
select_group_id = object_idx() * 1000000 + volume_idx() * 1000;
else if (select_by == "instance")
select_group_id = composite_id;
}
void GLVolume::set_drag_group_id(const std::string& drag_by)
{
if (drag_by == "object")
drag_group_id = object_idx() * 1000;
else if (drag_by == "instance")
drag_group_id = object_idx() * 1000 + instance_idx();
}
#endif // !ENABLE_EXTENDED_SELECTION
#if !ENABLE_MODELVOLUME_TRANSFORM
const Transform3f& GLVolume::world_matrix() const
{
if (m_world_matrix_dirty)
{
#if ENABLE_MIRROR
m_world_matrix = Geometry::assemble_transform(m_offset, m_rotation, m_scaling_factor, m_mirror).cast<float>();
#else
m_world_matrix = Geometry::assemble_transform(m_offset, m_rotation, m_scaling_factor).cast<float>();
#endif // ENABLE_MIRROR
m_world_matrix_dirty = false;
}
return m_world_matrix;
@ -730,23 +692,12 @@ void GLVolume::generate_layer_height_texture(const PrintObject *print_object, bo
#define LAYER_HEIGHT_TEXTURE_WIDTH 1024
#define LAYER_HEIGHT_TEXTURE_HEIGHT 1024
#if ENABLE_EXTENDED_SELECTION
std::vector<int> GLVolumeCollection::load_object(
const ModelObject *model_object,
int obj_idx,
const std::vector<int> &instance_idxs,
const std::string &color_by,
bool use_VBOs)
#else
std::vector<int> GLVolumeCollection::load_object(
const ModelObject *model_object,
int obj_idx,
const std::vector<int> &instance_idxs,
const std::string &color_by,
const std::string &select_by,
const std::string &drag_by,
bool use_VBOs)
#endif // ENABLE_EXTENDED_SELECTION
{
static float colors[4][4] = {
{ 1.0f, 1.0f, 0.0f, 1.f },
@ -797,10 +748,6 @@ std::vector<int> GLVolumeCollection::load_object(
v.bounding_box = v.indexed_vertex_array.bounding_box();
v.indexed_vertex_array.finalize_geometry(use_VBOs);
v.composite_id = obj_idx * 1000000 + volume_idx * 1000 + instance_idx;
#if !ENABLE_EXTENDED_SELECTION
v.set_select_group_id(select_by);
v.set_drag_group_id(drag_by);
#endif // !ENABLE_EXTENDED_SELECTION
if (model_volume->is_model_part())
{
v.set_convex_hull(model_volume->get_convex_hull());
@ -816,9 +763,7 @@ std::vector<int> GLVolumeCollection::load_object(
v.set_offset(instance->get_offset());
v.set_rotation(instance->get_rotation());
v.set_scaling_factor(instance->get_scaling_factor());
#if ENABLE_MIRROR
v.set_mirror(instance->get_mirror());
#endif // ENABLE_MIRROR
#endif // ENABLE_MODELVOLUME_TRANSFORM
}
}
@ -894,10 +839,6 @@ int GLVolumeCollection::load_wipe_tower_preview(
v.bounding_box = v.indexed_vertex_array.bounding_box();
v.indexed_vertex_array.finalize_geometry(use_VBOs);
v.composite_id = obj_idx * 1000000;
#if !ENABLE_EXTENDED_SELECTION
v.select_group_id = obj_idx * 1000000;
v.drag_group_id = obj_idx * 1000;
#endif // !ENABLE_EXTENDED_SELECTION
v.is_wipe_tower = true;
v.shader_outside_printer_detection_enabled = ! size_unknown;
return int(this->volumes.size() - 1);
@ -1093,26 +1034,6 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con
}
}
#if !ENABLE_EXTENDED_SELECTION
void GLVolumeCollection::set_select_by(const std::string& select_by)
{
for (GLVolume *vol : this->volumes)
{
if (vol != nullptr)
vol->set_select_group_id(select_by);
}
}
void GLVolumeCollection::set_drag_by(const std::string& drag_by)
{
for (GLVolume *vol : this->volumes)
{
if (vol != nullptr)
vol->set_drag_group_id(drag_by);
}
}
#endif // !ENABLE_EXTENDED_SELECTION
std::vector<double> GLVolumeCollection::get_current_print_zs(bool active_only) const
{
// Collect layer top positions of all volumes.
@ -1884,23 +1805,6 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas)
s_canvas_mgr.reset_volumes(canvas);
}
#if !ENABLE_EXTENDED_SELECTION
void _3DScene::deselect_volumes(wxGLCanvas* canvas)
{
s_canvas_mgr.deselect_volumes(canvas);
}
void _3DScene::select_volume(wxGLCanvas* canvas, unsigned int id)
{
s_canvas_mgr.select_volume(canvas, id);
}
void _3DScene::update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections)
{
s_canvas_mgr.update_volumes_selection(canvas, selections);
}
#endif // !ENABLE_EXTENDED_SELECTION
int _3DScene::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config)
{
return s_canvas_mgr.check_volumes_outside_state(canvas, config);
@ -1916,17 +1820,10 @@ bool _3DScene::move_volume_down(wxGLCanvas* canvas, unsigned int id)
return s_canvas_mgr.move_volume_down(canvas, id);
}
#if ENABLE_EXTENDED_SELECTION
GUI::GLCanvas3D* _3DScene::get_canvas(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_canvas(canvas);
}
#else
void _3DScene::set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections)
{
s_canvas_mgr.set_objects_selections(canvas, selections);
}
#endif // ENABLE_EXTENDED_SELECTION
void _3DScene::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config)
{
@ -1973,23 +1870,6 @@ void _3DScene::set_color_by(wxGLCanvas* canvas, const std::string& value)
s_canvas_mgr.set_color_by(canvas, value);
}
#if !ENABLE_EXTENDED_SELECTION
void _3DScene::set_select_by(wxGLCanvas* canvas, const std::string& value)
{
s_canvas_mgr.set_select_by(canvas, value);
}
void _3DScene::set_drag_by(wxGLCanvas* canvas, const std::string& value)
{
s_canvas_mgr.set_drag_by(canvas, value);
}
std::string _3DScene::get_select_by(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_select_by(canvas);
}
#endif // !ENABLE_EXTENDED_SELECTION
bool _3DScene::is_layers_editing_enabled(wxGLCanvas* canvas)
{
return s_canvas_mgr.is_layers_editing_enabled(canvas);
@ -2167,14 +2047,10 @@ int _3DScene::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx)
return s_canvas_mgr.get_in_object_volume_id(canvas, scene_vol_idx);
}
#if ENABLE_MIRROR
#if ENABLE_EXTENDED_SELECTION
void _3DScene::mirror_selection(wxGLCanvas* canvas, Axis axis)
{
s_canvas_mgr.mirror_selection(canvas, axis);
}
#endif // ENABLE_EXTENDED_SELECTION
#endif // ENABLE_MIRROR
void _3DScene::reload_scene(wxGLCanvas* canvas, bool force)
{

View File

@ -263,10 +263,8 @@ private:
Vec3d m_rotation;
// Scale factor along the three axes of the volume to be rendered.
Vec3d m_scaling_factor;
#if ENABLE_MIRROR
// Mirroring along the three axes of the volume to be rendered.
Vec3d m_mirror;
#endif // ENABLE_MIRROR
// World matrix of the volume to be rendered.
mutable Transform3f m_world_matrix;
// Whether or not is needed to recalculate the world matrix.
@ -292,12 +290,6 @@ public:
float render_color[4];
// An ID containing the object ID, volume ID and instance ID.
int composite_id;
#if !ENABLE_EXTENDED_SELECTION
// An ID for group selection. It may be the same for all meshes of all object instances, or for just a single object instance.
int select_group_id;
// An ID for group dragging. It may be the same for all meshes of all object instances, or for just a single object instance.
int drag_group_id;
#endif // !ENABLE_EXTENDED_SELECTION
// An ID containing the extruder ID (used to select color).
int extruder_id;
// Is this object selected?
@ -358,28 +350,22 @@ public:
void set_scaling_factor(const Vec3d& scaling_factor) { m_transformation.set_scaling_factor(scaling_factor); set_bounding_boxes_as_dirty(); }
void set_scaling_factor(Axis axis, double scaling_factor) { m_transformation.set_scaling_factor(axis, scaling_factor); set_bounding_boxes_as_dirty(); }
#if ENABLE_MIRROR
const Vec3d& get_mirror() const { return m_transformation.get_mirror(); }
double get_mirror(Axis axis) const { return m_transformation.get_mirror(axis); }
void set_mirror(const Vec3d& mirror) { m_transformation.set_mirror(mirror); set_bounding_boxes_as_dirty(); }
void set_mirror(Axis axis, double mirror) { m_transformation.set_mirror(axis, mirror); set_bounding_boxes_as_dirty(); }
#endif // ENABLE_MIRROR
#else
const Vec3d& get_rotation() const;
void set_rotation(const Vec3d& rotation);
#if ENABLE_EXTENDED_SELECTION
const Vec3d& get_scaling_factor() const;
#endif // ENABLE_EXTENDED_SELECTION
void set_scaling_factor(const Vec3d& scaling_factor);
#if ENABLE_MIRROR
const Vec3d& get_mirror() const;
double get_mirror(Axis axis) const;
void set_mirror(const Vec3d& mirror);
void set_mirror(Axis axis, double mirror);
#endif // ENABLE_MIRROR
const Vec3d& get_offset() const;
void set_offset(const Vec3d& offset);
@ -387,17 +373,12 @@ public:
void set_convex_hull(const TriangleMesh& convex_hull);
#if !ENABLE_EXTENDED_SELECTION
void set_select_group_id(const std::string& select_by);
void set_drag_group_id(const std::string& drag_by);
#endif // !ENABLE_EXTENDED_SELECTION
int object_idx() const { return this->composite_id / 1000000; }
int volume_idx() const { return (this->composite_id / 1000) % 1000; }
int instance_idx() const { return this->composite_id % 1000; }
#if ENABLE_MODELVOLUME_TRANSFORM
const Transform3d& world_matrix() const { return m_transformation.world_matrix(); }
const Transform3d& world_matrix() const { return m_transformation.get_matrix(); }
#else
const Transform3f& world_matrix() const;
#endif // ENABLE_MODELVOLUME_TRANSFORM
@ -456,9 +437,7 @@ public:
#endif // ENABLE_MODELVOLUME_TRANSFORM
};
#if ENABLE_EXTENDED_SELECTION
typedef std::vector<GLVolume*> GLVolumePtrs;
#endif // ENABLE_EXTENDED_SELECTION
class GLVolumeCollection
{
@ -467,32 +446,17 @@ class GLVolumeCollection
float print_box_max[3];
public:
#if ENABLE_EXTENDED_SELECTION
GLVolumePtrs volumes;
#else
std::vector<GLVolume*> volumes;
#endif // ENABLE_EXTENDED_SELECTION
GLVolumeCollection() {};
~GLVolumeCollection() { clear(); };
#if ENABLE_EXTENDED_SELECTION
std::vector<int> load_object(
const ModelObject *model_object,
int obj_idx,
const std::vector<int> &instance_idxs,
const std::string &color_by,
bool use_VBOs);
#else
std::vector<int> load_object(
const ModelObject *model_object,
int obj_idx,
const std::vector<int> &instance_idxs,
const std::string &color_by,
const std::string &select_by,
const std::string &drag_by,
bool use_VBOs);
#endif // ENABLE_EXTENDED_SELECTION
int load_wipe_tower_preview(
int obj_idx, float pos_x, float pos_y, float width, float depth, float height, float rotation_angle, bool use_VBOs, bool size_unknown, float brim_width);
@ -526,11 +490,6 @@ public:
void update_colors_by_extruder(const DynamicPrintConfig* config);
#if !ENABLE_EXTENDED_SELECTION
void set_select_by(const std::string& select_by);
void set_drag_by(const std::string& drag_by);
#endif // !ENABLE_EXTENDED_SELECTION
// Returns a vector containing the sorted list of all the print_zs of the volumes contained in this collection
std::vector<double> get_current_print_zs(bool active_only) const;
@ -558,20 +517,11 @@ public:
static unsigned int get_volumes_count(wxGLCanvas* canvas);
static void reset_volumes(wxGLCanvas* canvas);
#if !ENABLE_EXTENDED_SELECTION
static void deselect_volumes(wxGLCanvas* canvas);
static void select_volume(wxGLCanvas* canvas, unsigned int id);
static void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
static int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config);
static bool move_volume_up(wxGLCanvas* canvas, unsigned int id);
static bool move_volume_down(wxGLCanvas* canvas, unsigned int id);
#if ENABLE_EXTENDED_SELECTION
static GUI::GLCanvas3D* get_canvas(wxGLCanvas* canvas);
#else
static void set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections);
#endif // ENABLE_EXTENDED_SELECTION
static void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
static void set_print(wxGLCanvas* canvas, Print* print);
@ -587,12 +537,6 @@ public:
static void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons);
static void set_color_by(wxGLCanvas* canvas, const std::string& value);
#if !ENABLE_EXTENDED_SELECTION
static void set_select_by(wxGLCanvas* canvas, const std::string& value);
static void set_drag_by(wxGLCanvas* canvas, const std::string& value);
static std::string get_select_by(wxGLCanvas* canvas);
#endif // !ENABLE_EXTENDED_SELECTION
static bool is_layers_editing_enabled(wxGLCanvas* canvas);
static bool is_layers_editing_allowed(wxGLCanvas* canvas);
@ -634,11 +578,7 @@ public:
static int get_first_volume_id(wxGLCanvas* canvas, int obj_idx);
static int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx);
#if ENABLE_MIRROR
#if ENABLE_EXTENDED_SELECTION
static void mirror_selection(wxGLCanvas* canvas, Axis axis);
#endif // ENABLE_EXTENDED_SELECTION
#endif // ENABLE_MIRROR
static void reload_scene(wxGLCanvas* canvas, bool force);

View File

@ -74,7 +74,7 @@ void BackgroundSlicingProcess::thread_proc()
this->set_step_done(bspsGCodeFinalize);
}
}
} catch (CanceledException &ex) {
} catch (CanceledException & /* ex */) {
// Canceled, this is all right.
assert(m_print->canceled());
} catch (std::exception &ex) {

View File

@ -235,14 +235,15 @@ void BedShapePanel::update_shape()
Vec2d rect_origin(Vec2d::Zero());
try{
rect_size = boost::any_cast<Vec2d>(m_optgroups[SHAPE_RECTANGULAR]->get_value("rect_size")); }
catch (const std::exception &e) {
catch (const std::exception & /* e */) {
return;
}
try{
try {
rect_origin = boost::any_cast<Vec2d>(m_optgroups[SHAPE_RECTANGULAR]->get_value("rect_origin"));
}
catch (const std::exception &e) {
return;}
catch (const std::exception & /* e */) {
return;
}
auto x = rect_size(0);
auto y = rect_size(1);
@ -270,7 +271,7 @@ void BedShapePanel::update_shape()
try{
diameter = boost::any_cast<double>(m_optgroups[SHAPE_CIRCULAR]->get_value("diameter"));
}
catch (const std::exception &e) {
catch (const std::exception & /* e */) {
return;
}
if (diameter == 0.0) return ;

View File

@ -831,8 +831,8 @@ ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason) :
topsizer->AddSpacer(INDEX_MARGIN);
topsizer->Add(p->hscroll, 1, wxEXPAND);
p->btn_prev = new wxButton(this, wxID_NONE, _(L("< &Back")));
p->btn_next = new wxButton(this, wxID_NONE, _(L("&Next >")));
p->btn_prev = new wxButton(this, wxID_ANY, _(L("< &Back")));
p->btn_next = new wxButton(this, wxID_ANY, _(L("&Next >")));
p->btn_finish = new wxButton(this, wxID_APPLY, _(L("&Finish")));
p->btn_cancel = new wxButton(this, wxID_CANCEL);
p->btnsizer->AddStretchSpacer();

View File

@ -39,7 +39,7 @@ private:
struct priv;
std::unique_ptr<priv> p;
friend class ConfigWizardPage;
friend struct ConfigWizardPage;
};

File diff suppressed because it is too large Load Diff

View File

@ -82,21 +82,7 @@ public:
void set_bottom(float bottom);
};
#if ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent);
#else
struct ObjectSelectEvent;
wxDECLARE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, ObjectSelectEvent);
struct ObjectSelectEvent : public ArrayEvent<ptrdiff_t, 2>
{
ObjectSelectEvent(ptrdiff_t object_id, ptrdiff_t volume_id, wxObject *origin = nullptr)
: ArrayEvent(EVT_GLCANVAS_OBJECT_SELECT, {object_id, volume_id}, origin)
{}
ptrdiff_t object_id() const { return data[0]; }
ptrdiff_t volume_id() const { return data[1]; }
};
#endif // ENABLE_EXTENDED_SELECTION
using Vec2dEvent = Event<Vec2d>;
template <size_t N> using Vec2dsEvent = ArrayEvent<Vec2d, N>;
@ -106,30 +92,16 @@ template <size_t N> using Vec3dsEvent = ArrayEvent<Vec3d, N>;
wxDECLARE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_VIEWPORT_CHANGED, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLCANVAS_DOUBLE_CLICK, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLCANVAS_RIGHT_CLICK, Vec2dEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_MODEL_UPDATE, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_REMOVE_OBJECT, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_ARRANGE, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLCANVAS_ROTATE_OBJECT, Event<int>); // data: -1 => rotate left, +1 => rotate right
wxDECLARE_EVENT(EVT_GLCANVAS_SCALE_UNIFORMLY, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLCANVAS_INCREASE_INSTANCES, Event<int>); // data: +1 => increase, -1 => decrease
wxDECLARE_EVENT(EVT_GLCANVAS_INSTANCE_MOVED, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent);
wxDECLARE_EVENT(EVT_GIZMO_ROTATE, Vec3dEvent);
wxDECLARE_EVENT(EVT_GIZMO_FLATTEN, Vec3dEvent);
#endif // !ENABLE_EXTENDED_SELECTION
class GLCanvas3D
{
struct GCodePreviewVolumeIndex
@ -356,15 +328,7 @@ class GLCanvas3D
Point start_position_2D;
Vec3d start_position_3D;
#if !ENABLE_EXTENDED_SELECTION
Vec3d volume_center_offset;
bool move_with_shift;
#endif // !ENABLE_EXTENDED_SELECTION
int move_volume_idx;
#if !ENABLE_EXTENDED_SELECTION
int gizmo_volume_idx;
#endif // !ENABLE_EXTENDED_SELECTION
public:
Drag();
@ -386,7 +350,6 @@ class GLCanvas3D
bool is_start_position_3D_defined() const;
};
#if ENABLE_EXTENDED_SELECTION
public:
class Selection
{
@ -504,9 +467,7 @@ public:
void translate(const Vec3d& displacement);
void rotate(const Vec3d& rotation);
void scale(const Vec3d& scale);
#if ENABLE_MIRROR
void mirror(Axis axis);
#endif // ENABLE_MIRROR
void translate(unsigned int object_idx, const Vec3d& displacement);
void translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement);
@ -531,8 +492,6 @@ public:
};
private:
#endif // ENABLE_EXTENDED_SELECTION
class Gizmos
{
static const float OverlayTexturesScale;
@ -566,20 +525,13 @@ private:
bool is_enabled() const;
void set_enabled(bool enable);
#if ENABLE_EXTENDED_SELECTION
std::string update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection);
void update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection);
void update_on_off_state(const Selection& selection);
#else
void update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos);
void update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos);
#endif // ENABLE_EXTENDED_SELECTION
void reset_all_states();
void set_hover_id(int id);
#if ENABLE_EXTENDED_SELECTION
void enable_grabber(EType type, unsigned int id, bool enable);
#endif // ENABLE_EXTENDED_SELECTION
bool overlay_contains_mouse(const GLCanvas3D& canvas, const Vec2d& mouse_pos) const;
bool grabber_contains_mouse() const;
@ -593,19 +545,10 @@ private:
bool is_running() const;
bool is_dragging() const;
#if ENABLE_EXTENDED_SELECTION
void start_dragging(const Selection& selection);
#else
void start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
void stop_dragging();
#if ENABLE_EXTENDED_SELECTION
Vec3d get_displacement() const;
#else
Vec3d get_position() const;
void set_position(const Vec3d& position);
#endif // ENABLE_EXTENDED_SELECTION
Vec3d get_scale() const;
void set_scale(const Vec3d& scale);
@ -621,13 +564,8 @@ private:
void clicked_on_object(const Vec2d& mouse_position);
void delete_current_grabber(bool delete_all = false);
#if ENABLE_EXTENDED_SELECTION
void render_current_gizmo(const Selection& selection) const;
void render_current_gizmo_for_picking_pass(const Selection& selection) const;
#else
void render_current_gizmo(const BoundingBoxf3& box) const;
void render_current_gizmo_for_picking_pass(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
void render_overlay(const GLCanvas3D& canvas) const;
@ -635,11 +573,7 @@ private:
void _reset();
void _render_overlay(const GLCanvas3D& canvas) const;
#if ENABLE_EXTENDED_SELECTION
void _render_current_gizmo(const Selection& selection) const;
#else
void _render_current_gizmo(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
float _get_total_overlay_height() const;
GLGizmoBase* _get_current() const;
@ -699,9 +633,7 @@ private:
mutable GLToolbar m_toolbar;
mutable GLVolumeCollection m_volumes;
#if ENABLE_EXTENDED_SELECTION
Selection m_selection;
#endif // ENABLE_EXTENDED_SELECTION
DynamicPrintConfig* m_config;
Print* m_print;
Model* m_model;
@ -720,21 +652,11 @@ private:
bool m_shader_enabled;
bool m_dynamic_background_enabled;
bool m_multisample_allowed;
#if ENABLE_EXTENDED_SELECTION
bool m_regenerate_volumes;
#endif // ENABLE_EXTENDED_SELECTION
std::string m_color_by;
#if !ENABLE_EXTENDED_SELECTION
std::string m_select_by;
std::string m_drag_by;
#endif // !ENABLE_EXTENDED_SELECTION
bool m_reload_delayed;
#if !ENABLE_EXTENDED_SELECTION
std::vector<std::vector<int>> m_objects_volumes_idxs;
std::vector<int> m_objects_selections;
#endif // !ENABLE_EXTENDED_SELECTION
GCodePreviewVolumeIndex m_gcode_preview_volume_index;
@ -761,27 +683,16 @@ public:
unsigned int get_volumes_count() const;
void reset_volumes();
#if !ENABLE_EXTENDED_SELECTION
void deselect_volumes();
void select_volume(unsigned int id);
void update_volumes_selection(const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
int check_volumes_outside_state(const DynamicPrintConfig* config) const;
bool move_volume_up(unsigned int id);
bool move_volume_down(unsigned int id);
#if !ENABLE_EXTENDED_SELECTION
void set_objects_selections(const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
void set_config(DynamicPrintConfig* config);
void set_print(Print* print);
void set_model(Model* model);
#if ENABLE_EXTENDED_SELECTION
const Selection& get_selection() const { return m_selection; }
Selection& get_selection() { return m_selection; }
#endif // ENABLE_EXTENDED_SELECTION
// 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,
@ -796,13 +707,6 @@ public:
void set_cutting_plane(float z, const ExPolygons& polygons);
void set_color_by(const std::string& value);
#if !ENABLE_EXTENDED_SELECTION
void set_select_by(const std::string& value);
void set_drag_by(const std::string& value);
const std::string& get_select_by() const;
const std::string& get_drag_by() const;
#endif // !ENABLE_EXTENDED_SELECTION
float get_camera_zoom() const;
@ -832,9 +736,7 @@ public:
void zoom_to_bed();
void zoom_to_volumes();
#if ENABLE_MODIFIED_CAMERA_TARGET
#if ENABLE_EXTENDED_SELECTION
void zoom_to_selection();
#endif // ENABLE_EXTENDED_SELECTION
#endif // ENABLE_MODIFIED_CAMERA_TARGET
void select_view(const std::string& direction);
void set_viewport_from_scene(const GLCanvas3D& other);
@ -855,11 +757,7 @@ public:
int get_first_volume_id(int obj_idx) const;
int get_in_object_volume_id(int scene_vol_idx) const;
#if ENABLE_MIRROR
#if ENABLE_EXTENDED_SELECTION
void mirror_selection(Axis axis);
#endif // ENABLE_EXTENDED_SELECTION
#endif // ENABLE_MIRROR
void reload_scene(bool force);
@ -897,9 +795,6 @@ private:
void _resize(unsigned int w, unsigned int h);
BoundingBoxf3 _max_bounding_box() const;
#if !ENABLE_EXTENDED_SELECTION
BoundingBoxf3 _selected_volumes_bounding_box() const;
#endif // !ENABLE_EXTENDED_SELECTION
void _zoom_to_bounding_box(const BoundingBoxf3& bbox);
float _get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const;
@ -913,9 +808,7 @@ private:
void _render_bed(float theta) const;
void _render_axes(bool depth_test) const;
void _render_objects() const;
#if ENABLE_EXTENDED_SELECTION
void _render_selection() const;
#endif // ENABLE_EXTENDED_SELECTION
void _render_cutting_plane() const;
void _render_warning_texture() const;
void _render_legend_texture() const;
@ -928,9 +821,7 @@ private:
void _render_camera_target() const;
#endif // ENABLE_SHOW_CAMERA_TARGET
#if ENABLE_EXTENDED_SELECTION
void _update_volumes_hover_state() const;
#endif // ENABLE_EXTENDED_SELECTION
float _get_layers_editing_cursor_z_relative() const;
void _perform_layer_editing_action(wxMouseEvent* evt = nullptr);
@ -948,11 +839,6 @@ private:
void _start_timer();
void _stop_timer();
#if !ENABLE_EXTENDED_SELECTION
int _get_first_selected_object_id() const;
int _get_first_selected_volume_id(int object_id) const;
#endif // !ENABLE_EXTENDED_SELECTION
// Create 3D thick extrusion lines for a skirt and brim.
// Adds a new Slic3r::GUI::3DScene::Volume to volumes.
void _load_print_toolpaths();
@ -981,20 +867,11 @@ private:
void _update_toolpath_volumes_outside_state();
void _show_warning_texture_if_needed();
#if ENABLE_EXTENDED_SELECTION
void _on_move();
void _on_rotate();
void _on_scale();
void _on_flatten();
#if ENABLE_MIRROR
void _on_mirror();
#endif // ENABLE_MIRROR
#else
void _on_move(const std::vector<int>& volume_idxs);
#endif // ENABLE_EXTENDED_SELECTION
#if !ENABLE_EXTENDED_SELECTION
void _on_select(int volume_idx, int object_idx);
#endif // !ENABLE_EXTENDED_SELECTION
// generates the legend texture in dependence of the current shown view type
void _generate_legend_texture(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);

View File

@ -246,29 +246,6 @@ void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas)
it->second->reset_volumes();
}
#if !ENABLE_EXTENDED_SELECTION
void GLCanvas3DManager::deselect_volumes(wxGLCanvas* canvas)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->deselect_volumes();
}
void GLCanvas3DManager::select_volume(wxGLCanvas* canvas, unsigned int id)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->select_volume(id);
}
void GLCanvas3DManager::update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->update_volumes_selection(selections);
}
#endif // !ENABLE_EXTENDED_SELECTION
int GLCanvas3DManager::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const
{
CanvasesMap::const_iterator it = _get_canvas(canvas);
@ -287,20 +264,11 @@ bool GLCanvas3DManager::move_volume_down(wxGLCanvas* canvas, unsigned int id)
return (it != m_canvases.end()) ? it->second->move_volume_down(id) : false;
}
#if ENABLE_EXTENDED_SELECTION
GLCanvas3D* GLCanvas3DManager::get_canvas(wxGLCanvas* canvas)
{
CanvasesMap::const_iterator it = _get_canvas(canvas);
return (it != m_canvases.end()) ? it->second : nullptr;
}
#else
void GLCanvas3DManager::set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->set_objects_selections(selections);
}
#endif // ENABLE_EXTENDED_SELECTION
void GLCanvas3DManager::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config)
{
@ -364,28 +332,6 @@ void GLCanvas3DManager::set_color_by(wxGLCanvas* canvas, const std::string& valu
it->second->set_color_by(value);
}
#if !ENABLE_EXTENDED_SELECTION
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);
}
std::string GLCanvas3DManager::get_select_by(wxGLCanvas* canvas) const
{
CanvasesMap::const_iterator it = _get_canvas(canvas);
return (it != m_canvases.end()) ? it->second->get_select_by() : "";
}
#endif // !ENABLE_EXTENDED_SELECTION
bool GLCanvas3DManager::is_layers_editing_enabled(wxGLCanvas* canvas) const
{
CanvasesMap::const_iterator it = _get_canvas(canvas);
@ -596,16 +542,12 @@ int GLCanvas3DManager::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol
return (it != m_canvases.end()) ? it->second->get_in_object_volume_id(scene_vol_idx) : -1;
}
#if ENABLE_MIRROR
#if ENABLE_EXTENDED_SELECTION
void GLCanvas3DManager::mirror_selection(wxGLCanvas* canvas, Axis axis)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->mirror_selection(axis);
}
#endif // ENABLE_EXTENDED_SELECTION
#endif // ENABLE_MIRROR
void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force)
{

View File

@ -87,20 +87,11 @@ public:
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
void reset_volumes(wxGLCanvas* canvas);
#if !ENABLE_EXTENDED_SELECTION
void deselect_volumes(wxGLCanvas* canvas);
void select_volume(wxGLCanvas* canvas, unsigned int id);
void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const;
bool move_volume_up(wxGLCanvas* canvas, unsigned int id);
bool move_volume_down(wxGLCanvas* canvas, unsigned int id);
#if ENABLE_EXTENDED_SELECTION
GLCanvas3D* get_canvas(wxGLCanvas* canvas);
#else
void set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections);
#endif // ENABLE_EXTENDED_SELECTION
void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
void set_print(wxGLCanvas* canvas, Print* print);
@ -116,12 +107,6 @@ public:
void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons);
void set_color_by(wxGLCanvas* canvas, const std::string& value);
#if !ENABLE_EXTENDED_SELECTION
void set_select_by(wxGLCanvas* canvas, const std::string& value);
void set_drag_by(wxGLCanvas* canvas, const std::string& value);
std::string get_select_by(wxGLCanvas* canvas) const;
#endif // !ENABLE_EXTENDED_SELECTION
bool is_layers_editing_enabled(wxGLCanvas* canvas) const;
bool is_layers_editing_allowed(wxGLCanvas* canvas) const;
@ -163,11 +148,7 @@ public:
int get_first_volume_id(wxGLCanvas* canvas, int obj_idx) const;
int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx) const;
#if ENABLE_MIRROR
#if ENABLE_EXTENDED_SELECTION
void mirror_selection(wxGLCanvas* canvas, Axis axis);
#endif // ENABLE_EXTENDED_SELECTION
#endif // ENABLE_MIRROR
void reload_scene(wxGLCanvas* canvas, bool force);

View File

@ -4,9 +4,6 @@
#include "GUI.hpp"
#include "../../libslic3r/Utils.hpp"
#if !ENABLE_EXTENDED_SELECTION
#include "../../slic3r/GUI/GLCanvas3D.hpp"
#endif // !ENABLE_EXTENDED_SELECTION
#include <Eigen/Dense>
#include "../../libslic3r/Geometry.hpp"
@ -26,91 +23,6 @@ static const float AXES_COLOR[3][3] = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f
namespace Slic3r {
namespace GUI {
#if !ENABLE_EXTENDED_SELECTION
// returns the intersection of the given ray with the plane parallel to plane XY and passing through the given center
// coordinates are local to the plane
Vec3d intersection_on_plane_xy(const Linef3& ray, const Vec3d& center)
{
Transform3d m = Transform3d::Identity();
m.translate(-center);
Vec2d mouse_pos_2d = to_2d(transform(ray, m).intersect_plane(0.0));
return Vec3d(mouse_pos_2d(0), mouse_pos_2d(1), 0.0);
}
// returns the intersection of the given ray with the plane parallel to plane XZ and passing through the given center
// coordinates are local to the plane
Vec3d intersection_on_plane_xz(const Linef3& ray, const Vec3d& center)
{
Transform3d m = Transform3d::Identity();
m.rotate(Eigen::AngleAxisd(-0.5 * (double)PI, Vec3d::UnitX()));
m.translate(-center);
Vec2d mouse_pos_2d = to_2d(transform(ray, m).intersect_plane(0.0));
return Vec3d(mouse_pos_2d(0), 0.0, mouse_pos_2d(1));
}
// returns the intersection of the given ray with the plane parallel to plane YZ and passing through the given center
// coordinates are local to the plane
Vec3d intersection_on_plane_yz(const Linef3& ray, const Vec3d& center)
{
Transform3d m = Transform3d::Identity();
m.rotate(Eigen::AngleAxisd(-0.5f * (double)PI, Vec3d::UnitY()));
m.translate(-center);
Vec2d mouse_pos_2d = to_2d(transform(ray, m).intersect_plane(0.0));
return Vec3d(0.0, mouse_pos_2d(1), -mouse_pos_2d(0));
}
// return an index:
// 0 for plane XY
// 1 for plane XZ
// 2 for plane YZ
// which indicates which plane is best suited for intersecting the given unit vector
// giving precedence to the plane with the given index
unsigned int select_best_plane(const Vec3d& unit_vector, unsigned int preferred_plane)
{
unsigned int ret = preferred_plane;
// 1st checks if the given vector is not parallel to the given preferred plane
double dot_to_normal = 0.0;
switch (ret)
{
case 0: // plane xy
{
dot_to_normal = std::abs(unit_vector.dot(Vec3d::UnitZ()));
break;
}
case 1: // plane xz
{
dot_to_normal = std::abs(unit_vector.dot(-Vec3d::UnitY()));
break;
}
case 2: // plane yz
{
dot_to_normal = std::abs(unit_vector.dot(Vec3d::UnitX()));
break;
}
default:
{
break;
}
}
// if almost parallel, select the plane whose normal direction is closest to the given vector direction,
// otherwise return the given preferred plane index
if (dot_to_normal < 0.1)
{
typedef std::map<double, unsigned int> ProjsMap;
ProjsMap projs_map;
projs_map.insert(ProjsMap::value_type(std::abs(unit_vector.dot(Vec3d::UnitZ())), 0)); // plane xy
projs_map.insert(ProjsMap::value_type(std::abs(unit_vector.dot(-Vec3d::UnitY())), 1)); // plane xz
projs_map.insert(ProjsMap::value_type(std::abs(unit_vector.dot(Vec3d::UnitX())), 2)); // plane yz
ret = projs_map.rbegin()->second;
}
return ret;
}
#endif // !ENABLE_EXTENDED_SELECTION
const float GLGizmoBase::Grabber::SizeFactor = 0.025f;
const float GLGizmoBase::Grabber::MinHalfSize = 1.5f;
const float GLGizmoBase::Grabber::DraggingScaleFactor = 1.25f;
@ -262,11 +174,7 @@ void GLGizmoBase::disable_grabber(unsigned int id)
on_disable_grabber(id);
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoBase::start_dragging(const GLCanvas3D::Selection& selection)
#else
void GLGizmoBase::start_dragging(const BoundingBoxf3& box)
#endif // ENABLE_EXTENDED_SELECTION
{
m_dragging = true;
@ -275,11 +183,7 @@ void GLGizmoBase::start_dragging(const BoundingBoxf3& box)
m_grabbers[i].dragging = (m_hover_id == i);
}
#if ENABLE_EXTENDED_SELECTION
on_start_dragging(selection);
#else
on_start_dragging(box);
#endif // ENABLE_EXTENDED_SELECTION
}
void GLGizmoBase::stop_dragging()
@ -385,15 +289,9 @@ bool GLGizmoRotate::on_init()
return true;
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoRotate::on_start_dragging(const GLCanvas3D::Selection& selection)
#else
void GLGizmoRotate::on_start_dragging(const BoundingBoxf3& box)
#endif // ENABLE_EXTENDED_SELECTION
{
#if ENABLE_EXTENDED_SELECTION
const BoundingBoxf3& box = selection.get_bounding_box();
#endif // ENABLE_EXTENDED_SELECTION
m_center = box.center();
m_radius = Offset + box.radius();
m_snap_coarse_in_radius = m_radius / 3.0f;
@ -437,16 +335,11 @@ void GLGizmoRotate::on_update(const Linef3& mouse_ray, const Point* mouse_positi
m_angle = theta;
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoRotate::on_render(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoRotate::on_render(const BoundingBoxf3& box) const
#endif // ENABLE_EXTENDED_SELECTION
{
if (!m_grabbers[0].enabled)
return;
#if ENABLE_EXTENDED_SELECTION
const BoundingBoxf3& box = selection.get_bounding_box();
bool single_instance = selection.is_single_full_instance();
@ -460,10 +353,6 @@ void GLGizmoRotate::on_render(const BoundingBoxf3& box) const
if ((single_instance && (m_hover_id == 0)) || m_dragging)
set_tooltip(axis + format((float)Geometry::rad2deg(m_angle), 4) + "\u00B0");
#else
if (m_dragging)
set_tooltip(format(m_angle * 180.0f / (float)PI, 4));
#endif // ENABLE_EXTENDED_SELECTION
else
{
m_center = box.center();
@ -501,22 +390,14 @@ void GLGizmoRotate::on_render(const BoundingBoxf3& box) const
::glPopMatrix();
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoRotate::on_render_for_picking(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoRotate::on_render_for_picking(const BoundingBoxf3& box) const
#endif // ENABLE_EXTENDED_SELECTION
{
::glDisable(GL_DEPTH_TEST);
::glPushMatrix();
transform_to_local();
#if ENABLE_EXTENDED_SELECTION
render_grabbers_for_picking(selection.get_bounding_box());
#else
render_grabbers_for_picking(box);
#endif // ENABLE_EXTENDED_SELECTION
::glPopMatrix();
}
@ -733,19 +614,11 @@ std::string GLGizmoRotate3D::on_get_name() const
return L("Rotate");
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoRotate3D::on_start_dragging(const GLCanvas3D::Selection& selection)
{
if ((0 <= m_hover_id) && (m_hover_id < 3))
m_gizmos[m_hover_id].start_dragging(selection);
}
#else
void GLGizmoRotate3D::on_start_dragging(const BoundingBoxf3& box)
{
if ((0 <= m_hover_id) && (m_hover_id < 3))
m_gizmos[m_hover_id].start_dragging(box);
}
#endif // ENABLE_EXTENDED_SELECTION
void GLGizmoRotate3D::on_stop_dragging()
{
@ -753,7 +626,6 @@ void GLGizmoRotate3D::on_stop_dragging()
m_gizmos[m_hover_id].stop_dragging();
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const
{
if ((m_hover_id == -1) || (m_hover_id == 0))
@ -765,24 +637,8 @@ void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const
if ((m_hover_id == -1) || (m_hover_id == 2))
m_gizmos[Z].render(selection);
}
#else
void GLGizmoRotate3D::on_render(const BoundingBoxf3& box) const
{
if ((m_hover_id == -1) || (m_hover_id == 0))
m_gizmos[X].render(box);
if ((m_hover_id == -1) || (m_hover_id == 1))
m_gizmos[Y].render(box);
if ((m_hover_id == -1) || (m_hover_id == 2))
m_gizmos[Z].render(box);
}
#endif // ENABLE_EXTENDED_SELECTION
const float GLGizmoScale3D::Offset = 5.0f;
#if !ENABLE_EXTENDED_SELECTION
const Vec3d GLGizmoScale3D::OffsetVec = (double)GLGizmoScale3D::Offset * Vec3d::Ones();
#endif // !ENABLE_EXTENDED_SELECTION
GLGizmoScale3D::GLGizmoScale3D(GLCanvas3D& parent)
: GLGizmoBase(parent)
@ -830,20 +686,12 @@ std::string GLGizmoScale3D::on_get_name() const
return L("Scale");
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoScale3D::on_start_dragging(const GLCanvas3D::Selection& selection)
#else
void GLGizmoScale3D::on_start_dragging(const BoundingBoxf3& box)
#endif // ENABLE_EXTENDED_SELECTION
{
if (m_hover_id != -1)
{
m_starting_drag_position = m_grabbers[m_hover_id].center;
#if ENABLE_EXTENDED_SELECTION
m_starting_box = selection.get_bounding_box();
#else
m_starting_box = BoundingBoxf3(box.min - OffsetVec, box.max + OffsetVec);
#endif // ENABLE_EXTENDED_SELECTION
}
}
@ -867,13 +715,8 @@ void GLGizmoScale3D::on_process_double_click()
}
#endif // ENABLE_GIZMOS_RESET
#if ENABLE_EXTENDED_SELECTION
void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
#endif // ENABLE_EXTENDED_SELECTION
{
#if ENABLE_EXTENDED_SELECTION
bool single_instance = selection.is_single_full_instance();
Vec3f scale = single_instance ? 100.0f * selection.get_volume(*selection.get_volume_idxs().begin())->get_scaling_factor().cast<float>() : 100.0f * m_scale.cast<float>();
@ -891,25 +734,9 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
tooltip += "Z: " + format(scale(2), 4) + "%";
set_tooltip(tooltip);
}
#else
if (m_grabbers[0].dragging || m_grabbers[1].dragging)
set_tooltip("X: " + format(100.0f * m_scale(0), 4) + "%");
else if (m_grabbers[2].dragging || m_grabbers[3].dragging)
set_tooltip("Y: " + format(100.0f * m_scale(1), 4) + "%");
else if (m_grabbers[4].dragging || m_grabbers[5].dragging)
set_tooltip("Z: " + format(100.0f * m_scale(2), 4) + "%");
else if (m_grabbers[6].dragging || m_grabbers[7].dragging || m_grabbers[8].dragging || m_grabbers[9].dragging)
{
std::string tooltip = "X: " + format(100.0f * m_scale(0), 4) + "%\n";
tooltip += "Y: " + format(100.0f * m_scale(1), 4) + "%\n";
tooltip += "Z: " + format(100.0f * m_scale(2), 4) + "%";
set_tooltip(tooltip);
}
#endif // ENABLE_EXTENDED_SELECTION
::glEnable(GL_DEPTH_TEST);
#if ENABLE_EXTENDED_SELECTION
BoundingBoxf3 box;
Transform3d transform = Transform3d::Identity();
Vec3d angles = Vec3d::Zero();
@ -935,86 +762,52 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
// gets angles from first selected volume
angles = v->get_rotation();
#if ENABLE_MIRROR
// consider rotation+mirror only components of the transform for offsets
offsets_transform = Geometry::assemble_transform(Vec3d::Zero(), angles, Vec3d::Ones(), v->get_mirror());
#else
// set rotation-only component of transform
offsets_transform = Geometry::assemble_transform(Vec3d::Zero(), angles);
#endif // ENABLE_MIRROR
}
else
box = selection.get_bounding_box();
m_box = box;
#else
m_box = BoundingBoxf3(box.min - OffsetVec, box.max + OffsetVec);
#endif // ENABLE_EXTENDED_SELECTION
const Vec3d& center = m_box.center();
#if ENABLE_EXTENDED_SELECTION
Vec3d offset_x = offsets_transform * Vec3d((double)Offset, 0.0, 0.0);
Vec3d offset_y = offsets_transform * Vec3d(0.0, (double)Offset, 0.0);
Vec3d offset_z = offsets_transform * Vec3d(0.0, 0.0, (double)Offset);
#endif // ENABLE_EXTENDED_SELECTION
// x axis
#if ENABLE_EXTENDED_SELECTION
m_grabbers[0].center = transform * Vec3d(m_box.min(0), center(1), center(2)) - offset_x;
m_grabbers[1].center = transform * Vec3d(m_box.max(0), center(1), center(2)) + offset_x;
#else
m_grabbers[0].center = Vec3d(m_box.min(0), center(1), center(2));
m_grabbers[1].center = Vec3d(m_box.max(0), center(1), center(2));
#endif // ENABLE_EXTENDED_SELECTION
::memcpy((void*)m_grabbers[0].color, (const void*)&AXES_COLOR[0], 3 * sizeof(float));
::memcpy((void*)m_grabbers[1].color, (const void*)&AXES_COLOR[0], 3 * sizeof(float));
// y axis
#if ENABLE_EXTENDED_SELECTION
m_grabbers[2].center = transform * Vec3d(center(0), m_box.min(1), center(2)) - offset_y;
m_grabbers[3].center = transform * Vec3d(center(0), m_box.max(1), center(2)) + offset_y;
#else
m_grabbers[2].center = Vec3d(center(0), m_box.min(1), center(2));
m_grabbers[3].center = Vec3d(center(0), m_box.max(1), center(2));
#endif // ENABLE_EXTENDED_SELECTION
::memcpy((void*)m_grabbers[2].color, (const void*)&AXES_COLOR[1], 3 * sizeof(float));
::memcpy((void*)m_grabbers[3].color, (const void*)&AXES_COLOR[1], 3 * sizeof(float));
// z axis
#if ENABLE_EXTENDED_SELECTION
m_grabbers[4].center = transform * Vec3d(center(0), center(1), m_box.min(2)) - offset_z;
m_grabbers[5].center = transform * Vec3d(center(0), center(1), m_box.max(2)) + offset_z;
#else
m_grabbers[4].center = Vec3d(center(0), center(1), m_box.min(2));
m_grabbers[5].center = Vec3d(center(0), center(1), m_box.max(2));
#endif // ENABLE_EXTENDED_SELECTION
::memcpy((void*)m_grabbers[4].color, (const void*)&AXES_COLOR[2], 3 * sizeof(float));
::memcpy((void*)m_grabbers[5].color, (const void*)&AXES_COLOR[2], 3 * sizeof(float));
// uniform
#if ENABLE_EXTENDED_SELECTION
m_grabbers[6].center = transform * Vec3d(m_box.min(0), m_box.min(1), center(2)) - offset_x - offset_y;
m_grabbers[7].center = transform * Vec3d(m_box.max(0), m_box.min(1), center(2)) + offset_x - offset_y;
m_grabbers[8].center = transform * Vec3d(m_box.max(0), m_box.max(1), center(2)) + offset_x + offset_y;
m_grabbers[9].center = transform * Vec3d(m_box.min(0), m_box.max(1), center(2)) - offset_x + offset_y;
#else
m_grabbers[6].center = Vec3d(m_box.min(0), m_box.min(1), center(2));
m_grabbers[7].center = Vec3d(m_box.max(0), m_box.min(1), center(2));
m_grabbers[8].center = Vec3d(m_box.max(0), m_box.max(1), center(2));
m_grabbers[9].center = Vec3d(m_box.min(0), m_box.max(1), center(2));
#endif // ENABLE_EXTENDED_SELECTION
for (int i = 6; i < 10; ++i)
{
::memcpy((void*)m_grabbers[i].color, (const void*)m_highlight_color, 3 * sizeof(float));
}
#if ENABLE_EXTENDED_SELECTION
// sets grabbers orientation
for (int i = 0; i < 10; ++i)
{
m_grabbers[i].angles = angles;
}
#endif // ENABLE_EXTENDED_SELECTION
::glLineWidth((m_hover_id != -1) ? 2.0f : 1.5f);
@ -1089,21 +882,12 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
}
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoScale3D::on_render_for_picking(const GLCanvas3D::Selection& selection) const
{
::glDisable(GL_DEPTH_TEST);
render_grabbers_for_picking(selection.get_bounding_box());
}
#else
void GLGizmoScale3D::on_render_for_picking(const BoundingBoxf3& box) const
{
::glDisable(GL_DEPTH_TEST);
render_grabbers_for_picking(box);
}
#endif // ENABLE_EXTENDED_SELECTION
void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int id_2) const
{
@ -1119,11 +903,7 @@ void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int
void GLGizmoScale3D::do_scale_x(const Linef3& mouse_ray)
{
#if ENABLE_EXTENDED_SELECTION
double ratio = calc_ratio(mouse_ray);
#else
double ratio = calc_ratio(1, mouse_ray, m_starting_box.center());
#endif // ENABLE_EXTENDED_SELECTION
if (ratio > 0.0)
m_scale(0) = m_starting_scale(0) * ratio;
@ -1131,11 +911,7 @@ void GLGizmoScale3D::do_scale_x(const Linef3& mouse_ray)
void GLGizmoScale3D::do_scale_y(const Linef3& mouse_ray)
{
#if ENABLE_EXTENDED_SELECTION
double ratio = calc_ratio(mouse_ray);
#else
double ratio = calc_ratio(2, mouse_ray, m_starting_box.center());
#endif // ENABLE_EXTENDED_SELECTION
if (ratio > 0.0)
m_scale(1) = m_starting_scale(1) * ratio;
@ -1143,11 +919,7 @@ void GLGizmoScale3D::do_scale_y(const Linef3& mouse_ray)
void GLGizmoScale3D::do_scale_z(const Linef3& mouse_ray)
{
#if ENABLE_EXTENDED_SELECTION
double ratio = calc_ratio(mouse_ray);
#else
double ratio = calc_ratio(1, mouse_ray, m_starting_box.center());
#endif // ENABLE_EXTENDED_SELECTION
if (ratio > 0.0)
m_scale(2) = m_starting_scale(2) * ratio;
@ -1155,19 +927,12 @@ void GLGizmoScale3D::do_scale_z(const Linef3& mouse_ray)
void GLGizmoScale3D::do_scale_uniform(const Linef3& mouse_ray)
{
#if ENABLE_EXTENDED_SELECTION
double ratio = calc_ratio(mouse_ray);
#else
Vec3d center = m_starting_box.center();
center(2) = m_box.min(2);
double ratio = calc_ratio(0, mouse_ray, center);
#endif // ENABLE_EXTENDED_SELECTION
if (ratio > 0.0)
m_scale = m_starting_scale * ratio;
}
#if ENABLE_EXTENDED_SELECTION
double GLGizmoScale3D::calc_ratio(const Linef3& mouse_ray) const
{
double ratio = 0.0;
@ -1194,53 +959,12 @@ double GLGizmoScale3D::calc_ratio(const Linef3& mouse_ray) const
return ratio;
}
#else
double GLGizmoScale3D::calc_ratio(unsigned int preferred_plane_id, const Linef3& mouse_ray, const Vec3d& center) const
{
double ratio = 0.0;
Vec3d starting_vec = m_starting_drag_position - center;
double len_starting_vec = starting_vec.norm();
if (len_starting_vec == 0.0)
return ratio;
Vec3d starting_vec_dir = starting_vec.normalized();
Vec3d mouse_dir = mouse_ray.unit_vector();
unsigned int plane_id = select_best_plane(mouse_dir, preferred_plane_id);
// ratio is given by the projection of the calculated intersection on the starting vector divided by the starting vector length
switch (plane_id)
{
case 0:
{
ratio = starting_vec_dir.dot(intersection_on_plane_xy(mouse_ray, center)) / len_starting_vec;
break;
}
case 1:
{
ratio = starting_vec_dir.dot(intersection_on_plane_xz(mouse_ray, center)) / len_starting_vec;
break;
}
case 2:
{
ratio = starting_vec_dir.dot(intersection_on_plane_yz(mouse_ray, center)) / len_starting_vec;
break;
}
}
return ratio;
}
#endif // ENABLE_EXTENDED_SELECTION
const double GLGizmoMove3D::Offset = 10.0;
GLGizmoMove3D::GLGizmoMove3D(GLCanvas3D& parent)
: GLGizmoBase(parent)
#if ENABLE_EXTENDED_SELECTION
, m_displacement(Vec3d::Zero())
#else
, m_position(Vec3d::Zero())
#endif // ENABLE_EXTENDED_SELECTION
, m_starting_drag_position(Vec3d::Zero())
, m_starting_box_center(Vec3d::Zero())
, m_starting_box_bottom_center(Vec3d::Zero())
@ -1276,18 +1000,12 @@ std::string GLGizmoMove3D::on_get_name() const
return L("Move");
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoMove3D::on_start_dragging(const GLCanvas3D::Selection& selection)
#else
void GLGizmoMove3D::on_start_dragging(const BoundingBoxf3& box)
#endif // ENABLE_EXTENDED_SELECTION
{
if (m_hover_id != -1)
{
#if ENABLE_EXTENDED_SELECTION
m_displacement = Vec3d::Zero();
const BoundingBoxf3& box = selection.get_bounding_box();
#endif // ENABLE_EXTENDED_SELECTION
m_starting_drag_position = m_grabbers[m_hover_id].center;
m_starting_box_center = box.center();
m_starting_box_bottom_center = box.center();
@ -1295,39 +1013,23 @@ void GLGizmoMove3D::on_start_dragging(const BoundingBoxf3& box)
}
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoMove3D::on_stop_dragging()
{
m_displacement = Vec3d::Zero();
}
#endif // ENABLE_EXTENDED_SELECTION
void GLGizmoMove3D::on_update(const Linef3& mouse_ray, const Point* mouse_pos)
{
#if ENABLE_EXTENDED_SELECTION
if (m_hover_id == 0)
m_displacement(0) = calc_projection(mouse_ray);
else if (m_hover_id == 1)
m_displacement(1) = calc_projection(mouse_ray);
else if (m_hover_id == 2)
m_displacement(2) = calc_projection(mouse_ray);
#else
if (m_hover_id == 0)
m_position(0) = 2.0 * m_starting_box_center(0) + calc_projection(X, 1, mouse_ray) - m_starting_drag_position(0);
else if (m_hover_id == 1)
m_position(1) = 2.0 * m_starting_box_center(1) + calc_projection(Y, 2, mouse_ray) - m_starting_drag_position(1);
else if (m_hover_id == 2)
m_position(2) = 2.0 * m_starting_box_bottom_center(2) + calc_projection(Z, 1, mouse_ray) - m_starting_drag_position(2);
#endif // ENABLE_EXTENDED_SELECTION
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const
#endif // ENABLE_EXTENDED_SELECTION
{
#if ENABLE_EXTENDED_SELECTION
bool show_position = selection.is_single_full_instance();
const Vec3d& position = selection.get_bounding_box().center();
@ -1337,20 +1039,10 @@ void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const
set_tooltip("Y: " + format(show_position ? position(1) : m_displacement(1), 2));
else if ((show_position && (m_hover_id == 2)) || m_grabbers[2].dragging)
set_tooltip("Z: " + format(show_position ? position(2) : m_displacement(2), 2));
#else
if (m_grabbers[0].dragging)
set_tooltip("X: " + format(m_position(0), 2));
else if (m_grabbers[1].dragging)
set_tooltip("Y: " + format(m_position(1), 2));
else if (m_grabbers[2].dragging)
set_tooltip("Z: " + format(m_position(2), 2));
#endif // ENABLE_EXTENDED_SELECTION
::glEnable(GL_DEPTH_TEST);
#if ENABLE_EXTENDED_SELECTION
const BoundingBoxf3& box = selection.get_bounding_box();
#endif // ENABLE_EXTENDED_SELECTION
const Vec3d& center = box.center();
// x axis
@ -1399,23 +1091,13 @@ void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const
}
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoMove3D::on_render_for_picking(const GLCanvas3D::Selection& selection) const
{
::glDisable(GL_DEPTH_TEST);
render_grabbers_for_picking(selection.get_bounding_box());
}
#else
void GLGizmoMove3D::on_render_for_picking(const BoundingBoxf3& box) const
{
::glDisable(GL_DEPTH_TEST);
render_grabbers_for_picking(box);
}
#endif // ENABLE_EXTENDED_SELECTION
#if ENABLE_EXTENDED_SELECTION
double GLGizmoMove3D::calc_projection(const Linef3& mouse_ray) const
{
double projection = 0.0;
@ -1438,43 +1120,6 @@ double GLGizmoMove3D::calc_projection(const Linef3& mouse_ray) const
}
return projection;
}
#else
double GLGizmoMove3D::calc_projection(Axis axis, unsigned int preferred_plane_id, const Linef3& mouse_ray) const
{
double projection = 0.0;
Vec3d starting_vec = (axis == Z) ? m_starting_drag_position - m_starting_box_bottom_center : m_starting_drag_position - m_starting_box_center;
double len_starting_vec = starting_vec.norm();
if (len_starting_vec == 0.0)
return projection;
Vec3d starting_vec_dir = starting_vec.normalized();
Vec3d mouse_dir = mouse_ray.unit_vector();
unsigned int plane_id = select_best_plane(mouse_dir, preferred_plane_id);
switch (plane_id)
{
case 0:
{
projection = starting_vec_dir.dot(intersection_on_plane_xy(mouse_ray, (axis == Z) ? m_starting_box_bottom_center : m_starting_box_center));
break;
}
case 1:
{
projection = starting_vec_dir.dot(intersection_on_plane_xz(mouse_ray, (axis == Z) ? m_starting_box_bottom_center : m_starting_box_center));
break;
}
case 2:
{
projection = starting_vec_dir.dot(intersection_on_plane_yz(mouse_ray, (axis == Z) ? m_starting_box_bottom_center : m_starting_box_center));
break;
}
}
return projection;
}
#endif // ENABLE_EXTENDED_SELECTION
GLGizmoFlatten::GLGizmoFlatten(GLCanvas3D& parent)
: GLGizmoBase(parent)
@ -1507,42 +1152,24 @@ std::string GLGizmoFlatten::on_get_name() const
return L("Flatten");
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoFlatten::on_start_dragging(const GLCanvas3D::Selection& selection)
#else
void GLGizmoFlatten::on_start_dragging(const BoundingBoxf3& box)
#endif // ENABLE_EXTENDED_SELECTION
{
if (m_hover_id != -1)
{
m_normal = m_planes[m_hover_id].normal;
#if ENABLE_EXTENDED_SELECTION
m_starting_center = selection.get_bounding_box().center();
#else
m_starting_center = box.center();
#endif // ENABLE_EXTENDED_SELECTION
}
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoFlatten::on_render(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoFlatten::on_render(const BoundingBoxf3& box) const
#endif // ENABLE_EXTENDED_SELECTION
{
// the dragged_offset is a vector measuring where was the object moved
// with the gizmo being on. This is reset in set_flattening_data and
// does not work correctly when there are multiple copies.
Vec3d dragged_offset(Vec3d::Zero());
#if ENABLE_EXTENDED_SELECTION
if (m_starting_center == Vec3d::Zero())
m_starting_center = selection.get_bounding_box().center();
dragged_offset = selection.get_bounding_box().center() - m_starting_center;
#else
if (m_starting_center == Vec3d::Zero())
m_starting_center = box.center();
dragged_offset = box.center() - m_starting_center;
#endif // ENABLE_EXTENDED_SELECTION
::glEnable(GL_BLEND);
::glEnable(GL_DEPTH_TEST);
@ -1554,7 +1181,6 @@ void GLGizmoFlatten::on_render(const BoundingBoxf3& box) const
else
::glColor4f(0.9f, 0.9f, 0.9f, 0.5f);
#if ENABLE_EXTENDED_SELECTION
int instance_idx = selection.get_instance_idx();
if ((instance_idx != -1) && (m_model_object != nullptr))
{
@ -1570,30 +1196,13 @@ void GLGizmoFlatten::on_render(const BoundingBoxf3& box) const
::glEnd();
::glPopMatrix();
}
#else
for (const InstanceData& inst : m_instances) {
Transform3d m = inst.matrix;
m.pretranslate(dragged_offset);
::glPushMatrix();
::glMultMatrixd(m.data());
::glBegin(GL_POLYGON);
for (const Vec3d& vertex : m_planes[i].vertices)
::glVertex3dv(vertex.data());
::glEnd();
::glPopMatrix();
}
#endif // ENABLE_EXTENDED_SELECTION
}
::glEnable(GL_CULL_FACE);
::glDisable(GL_BLEND);
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoFlatten::on_render_for_picking(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoFlatten::on_render_for_picking(const BoundingBoxf3& box) const
#endif // ENABLE_EXTENDED_SELECTION
{
::glEnable(GL_DEPTH_TEST);
::glDisable(GL_CULL_FACE);
@ -1601,7 +1210,6 @@ void GLGizmoFlatten::on_render_for_picking(const BoundingBoxf3& box) const
for (unsigned int i = 0; i < m_planes.size(); ++i)
{
::glColor3f(1.0f, 1.0f, picking_color_component(i));
#if ENABLE_EXTENDED_SELECTION
int instance_idx = selection.get_instance_idx();
if ((instance_idx != -1) && (m_model_object != nullptr))
{
@ -1615,17 +1223,6 @@ void GLGizmoFlatten::on_render_for_picking(const BoundingBoxf3& box) const
::glEnd();
::glPopMatrix();
}
#else
for (const InstanceData& inst : m_instances) {
::glPushMatrix();
::glMultMatrixd(inst.matrix.data());
::glBegin(GL_POLYGON);
for (const Vec3d& vertex : m_planes[i].vertices)
::glVertex3dv(vertex.data());
::glEnd();
::glPopMatrix();
}
#endif // ENABLE_EXTENDED_SELECTION
}
::glEnable(GL_CULL_FACE);
@ -1636,15 +1233,6 @@ void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object)
m_starting_center = Vec3d::Zero();
m_model_object = model_object;
#if !ENABLE_EXTENDED_SELECTION
// ...and save the updated positions of the object instances:
if (m_model_object && !m_model_object->instances.empty()) {
m_instances.clear();
for (const auto* instance : m_model_object->instances)
m_instances.emplace_back(instance->world_matrix());
}
#endif // !ENABLE_EXTENDED_SELECTION
if (is_plane_update_necessary())
update_planes();
}
@ -1895,11 +1483,7 @@ void GLGizmoSlaSupports::set_model_object_ptr(ModelObject* model_object)
update_mesh();
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoSlaSupports::on_render(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const
#endif
{
::glEnable(GL_BLEND);
::glEnable(GL_DEPTH_TEST);
@ -1908,15 +1492,9 @@ void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const
// with the gizmo being on. This is reset in set_flattening_data and
// does not work correctly when there are multiple copies.
#if ENABLE_EXTENDED_SELECTION
if (m_starting_center == Vec3d::Zero())
m_starting_center = selection.get_bounding_box().center();
Vec3d dragged_offset = selection.get_bounding_box().center() - m_starting_center;
#else
if (m_starting_center == Vec3d::Zero())
m_starting_center = box.center();
Vec3d dragged_offset(box.center() - m_starting_center);
#endif // ENABLE_EXTENDED_SELECTION
for (auto& g : m_grabbers) {
g.color[0] = 1.f;
@ -1934,11 +1512,7 @@ void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const
}
#if ENABLE_EXTENDED_SELECTION
void GLGizmoSlaSupports::on_render_for_picking(const GLCanvas3D::Selection& selection) const
#else
void GLGizmoSlaSupports::on_render_for_picking(const BoundingBoxf3& box) const
#endif
{
::glEnable(GL_DEPTH_TEST);
for (unsigned int i=0; i<m_grabbers.size(); ++i) {
@ -1986,13 +1560,7 @@ bool GLGizmoSlaSupports::is_mesh_update_necessary() const
if (m_state != On || !m_model_object || m_model_object->instances.empty())
return false;
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
if ((m_model_object->instances.front()->world_matrix() * m_source_data.matrix.inverse() * Vec3d(1., 1., 1.) - Vec3d(1., 1., 1.)).norm() > 0.001 )
#else
if (m_model_object->instances.front()->get_scaling_factor() != m_source_data.scaling_factor
|| m_model_object->instances.front()->get_rotation() != m_source_data.rotation
|| m_model_object->instances.front()->get_offset() != m_source_data.offset)
#endif // ENABLE_MODELINSTANCE_3D_ROTATION
return true;
// following should detect direct mesh changes (can be removed after the mesh is made completely immutable):
@ -2020,13 +1588,7 @@ void GLGizmoSlaSupports::update_mesh()
F(i, 1) = 3*i+1;
F(i, 2) = 3*i+2;
}
#if !ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
m_source_data.scaling_factor = m_model_object->instances.front()->get_scaling_factor();
m_source_data.rotation = m_model_object->instances.front()->get_rotation();
m_source_data.offset = m_model_object->instances.front()->get_offset();
#else
m_source_data.matrix = m_model_object->instances.front()->world_matrix();
#endif
const float* first_vertex = m_model_object->volumes.front()->get_convex_hull().first_vertex();
m_source_data.mesh_first_point = Vec3d((double)first_vertex[0], (double)first_vertex[1], (double)first_vertex[2]);
// we'll now reload Grabbers (selection might have changed):

View File

@ -2,9 +2,7 @@
#define slic3r_GLGizmo_hpp_
#include "../../slic3r/GUI/GLTexture.hpp"
#if ENABLE_EXTENDED_SELECTION
#include "../../slic3r/GUI/GLCanvas3D.hpp"
#endif // ENABLE_EXTENDED_SELECTION
#include "../../libslic3r/Point.hpp"
#include "../../libslic3r/BoundingBox.hpp"
@ -82,9 +80,7 @@ public:
EState get_state() const { return m_state; }
void set_state(EState state) { m_state = state; on_set_state(); }
#if ENABLE_EXTENDED_SELECTION
bool is_activable(const GLCanvas3D::Selection& selection) const { return on_is_activable(selection); }
#endif // ENABLE_EXTENDED_SELECTION
unsigned int get_texture_id() const { return m_textures[m_state].get_id(); }
int get_textures_size() const { return m_textures[Off].get_width(); }
@ -97,11 +93,7 @@ public:
void enable_grabber(unsigned int id);
void disable_grabber(unsigned int id);
#if ENABLE_EXTENDED_SELECTION
void start_dragging(const GLCanvas3D::Selection& selection);
#else
void start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
void stop_dragging();
bool is_dragging() const { return m_dragging; }
@ -111,41 +103,25 @@ public:
void process_double_click() { on_process_double_click(); }
#endif // ENABLE_GIZMOS_RESET
#if ENABLE_EXTENDED_SELECTION
void render(const GLCanvas3D::Selection& selection) const { on_render(selection); }
void render_for_picking(const GLCanvas3D::Selection& selection) const { on_render_for_picking(selection); }
#else
void render(const BoundingBoxf3& box) const { on_render(box); }
void render_for_picking(const BoundingBoxf3& box) const { on_render_for_picking(box); }
#endif // ENABLE_EXTENDED_SELECTION
protected:
virtual bool on_init() = 0;
virtual std::string on_get_name() const = 0;
virtual void on_set_state() {}
virtual void on_set_hover_id() {}
#if ENABLE_EXTENDED_SELECTION
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return true; }
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_enable_grabber(unsigned int id) {}
virtual void on_disable_grabber(unsigned int id) {}
#if ENABLE_EXTENDED_SELECTION
virtual void on_start_dragging(const GLCanvas3D::Selection& selection) {}
#else
virtual void on_start_dragging(const BoundingBoxf3& box) {}
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_stop_dragging() {}
virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos) = 0;
#if ENABLE_GIZMOS_RESET
virtual void on_process_double_click() {}
#endif // ENABLE_GIZMOS_RESET
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const = 0;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const = 0;
#else
virtual void on_render(const BoundingBoxf3& box) const = 0;
virtual void on_render_for_picking(const BoundingBoxf3& box) const = 0;
#endif // ENABLE_EXTENDED_SELECTION
float picking_color_component(unsigned int id) const;
void render_grabbers(const BoundingBoxf3& box) const;
@ -196,22 +172,13 @@ public:
protected:
virtual bool on_init();
virtual std::string on_get_name() const { return ""; }
#if ENABLE_EXTENDED_SELECTION
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
#else
virtual void on_start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos);
#if ENABLE_GIZMOS_RESET
virtual void on_process_double_click() { m_angle = 0.0; }
#endif // ENABLE_GIZMOS_RESET
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#else
virtual void on_render(const BoundingBoxf3& box) const;
virtual void on_render_for_picking(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
private:
void render_circle() const;
@ -253,9 +220,7 @@ protected:
m_gizmos[i].set_hover_id((m_hover_id == i) ? 0 : -1);
}
}
#if ENABLE_EXTENDED_SELECTION
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return !selection.is_wipe_tower(); }
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_enable_grabber(unsigned int id)
{
if ((0 <= id) && (id < 3))
@ -266,11 +231,7 @@ protected:
if ((0 <= id) && (id < 3))
m_gizmos[id].disable_grabber(0);
}
#if ENABLE_EXTENDED_SELECTION
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
#else
virtual void on_start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_stop_dragging();
virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos)
{
@ -286,7 +247,6 @@ protected:
m_gizmos[m_hover_id].process_double_click();
}
#endif // ENABLE_GIZMOS_RESET
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const
{
@ -295,24 +255,11 @@ protected:
g.render_for_picking(selection);
}
}
#else
virtual void on_render(const BoundingBoxf3& box) const;
virtual void on_render_for_picking(const BoundingBoxf3& box) const
{
for (const GLGizmoRotate& g : m_gizmos)
{
g.render_for_picking(box);
}
}
#endif // ENABLE_EXTENDED_SELECTION
};
class GLGizmoScale3D : public GLGizmoBase
{
static const float Offset;
#if !ENABLE_EXTENDED_SELECTION
static const Vec3d OffsetVec;
#endif // !ENABLE_EXTENDED_SELECTION
mutable BoundingBoxf3 m_box;
@ -326,34 +273,19 @@ public:
explicit GLGizmoScale3D(GLCanvas3D& parent);
const Vec3d& get_scale() const { return m_scale; }
#if ENABLE_EXTENDED_SELECTION
void set_scale(const Vec3d& scale) { m_starting_scale = scale; m_scale = scale; }
#else
void set_scale(const Vec3d& scale) { m_starting_scale = scale; }
#endif // ENABLE_EXTENDED_SELECTION
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
#if ENABLE_EXTENDED_SELECTION
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return !selection.is_wipe_tower(); }
#endif // ENABLE_EXTENDED_SELECTION
#if ENABLE_EXTENDED_SELECTION
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
#else
virtual void on_start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos);
#if ENABLE_GIZMOS_RESET
virtual void on_process_double_click();
#endif // ENABLE_GIZMOS_RESET
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#else
virtual void on_render(const BoundingBoxf3& box) const;
virtual void on_render_for_picking(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
private:
void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const;
@ -363,22 +295,14 @@ private:
void do_scale_z(const Linef3& mouse_ray);
void do_scale_uniform(const Linef3& mouse_ray);
#if ENABLE_EXTENDED_SELECTION
double calc_ratio(const Linef3& mouse_ray) const;
#else
double calc_ratio(unsigned int preferred_plane_id, const Linef3& mouse_ray, const Vec3d& center) const;
#endif // ENABLE_EXTENDED_SELECTION
};
class GLGizmoMove3D : public GLGizmoBase
{
static const double Offset;
#if ENABLE_EXTENDED_SELECTION
Vec3d m_displacement;
#else
Vec3d m_position;
#endif // ENABLE_EXTENDED_SELECTION
Vec3d m_starting_drag_position;
Vec3d m_starting_box_center;
Vec3d m_starting_box_bottom_center;
@ -386,37 +310,19 @@ class GLGizmoMove3D : public GLGizmoBase
public:
explicit GLGizmoMove3D(GLCanvas3D& parent);
#if ENABLE_EXTENDED_SELECTION
const Vec3d& get_displacement() const { return m_displacement; }
#else
const Vec3d& get_position() const { return m_position; }
void set_position(const Vec3d& position) { m_position = position; }
#endif // ENABLE_EXTENDED_SELECTION
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
#if ENABLE_EXTENDED_SELECTION
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
virtual void on_stop_dragging();
#else
virtual void on_start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos);
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#else
virtual void on_render(const BoundingBoxf3& box) const;
virtual void on_render_for_picking(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
private:
#if ENABLE_EXTENDED_SELECTION
double calc_projection(const Linef3& mouse_ray) const;
#else
double calc_projection(Axis axis, unsigned int preferred_plane_id, const Linef3& mouse_ray) const;
#endif // ENABLE_EXTENDED_SELECTION
};
class GLGizmoFlatten : public GLGizmoBase
@ -440,14 +346,6 @@ private:
SourceDataSummary m_source_data;
std::vector<PlaneData> m_planes;
#if !ENABLE_EXTENDED_SELECTION
struct InstanceData
{
Transform3d matrix;
InstanceData(const Transform3d& matrix) : matrix(matrix) {}
};
std::vector<InstanceData> m_instances;
#endif // !ENABLE_EXTENDED_SELECTION
mutable Vec3d m_starting_center;
const ModelObject* m_model_object = nullptr;
@ -463,22 +361,11 @@ public:
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
#if ENABLE_EXTENDED_SELECTION
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return selection.is_single_full_instance(); }
#endif // ENABLE_EXTENDED_SELECTION
#if ENABLE_EXTENDED_SELECTION
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
#else
virtual void on_start_dragging(const BoundingBoxf3& box);
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos) {}
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#else
virtual void on_render(const BoundingBoxf3& box) const;
virtual void on_render_for_picking(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
virtual void on_set_state()
{
if (m_state == On && is_plane_update_necessary())
@ -497,13 +384,7 @@ private:
Eigen::MatrixXi m_F; // facets indices
struct SourceDataSummary {
BoundingBoxf3 bounding_box;
#if !ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
Vec3d scaling_factor;
Vec3d rotation;
Vec3d offset;
#else
Transform3d matrix;
#endif
Vec3d mesh_first_point;
};
@ -521,13 +402,8 @@ public:
private:
bool on_init();
void on_update(const Linef3& mouse_ray, const Point* mouse_pos);
#if ENABLE_EXTENDED_SELECTION
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#else
virtual void on_render(const BoundingBoxf3& box) const;
virtual void on_render_for_picking(const BoundingBoxf3& box) const;
#endif // ENABLE_EXTENDED_SELECTION
void render_grabbers(bool picking = false) const;
void render_tooltip_texture() const;

View File

@ -25,13 +25,7 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_FEWER, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_SPLIT_OBJECTS, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_SPLIT_VOLUMES, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDEFINE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
wxDEFINE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDEFINE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
GLToolbarItem::Data::Data()

View File

@ -25,13 +25,7 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_FEWER, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_SPLIT_OBJECTS, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_SPLIT_VOLUMES, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
class GLToolbarItem
{

View File

@ -68,7 +68,7 @@ void enable_screensaver()
bool debugged()
{
#ifdef _WIN32
return IsDebuggerPresent();
return IsDebuggerPresent() == TRUE;
#else
return false;
#endif /* _WIN32 */
@ -233,7 +233,7 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
break;
}
}
catch (const std::exception &e)
catch (const std::exception & /* e */)
{
int i = 0;//no reason, just experiment
}

View File

@ -91,7 +91,7 @@ bool GUI_App::OnInit()
load_language();
// Suppress the '- default -' presets.
preset_bundle->set_default_suppressed(app_config->get("no_defaults").empty() ? false : true);
preset_bundle->set_default_suppressed(app_config->get("no_defaults") == "1");
// eval{
preset_bundle->load_presets(*app_config);
// };
@ -604,8 +604,9 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
bool GUI_App::check_unsaved_changes()
{
std::string dirty;
PrinterTechnology printer_technology = preset_bundle->printers.get_edited_preset().printer_technology();
for (Tab *tab : tabs_list)
if (tab->current_preset_is_dirty())
if (tab->supports_printer_technology(printer_technology) && tab->current_preset_is_dirty())
if (dirty.empty())
dirty = tab->name();
else
@ -639,9 +640,13 @@ void GUI_App::delete_tab_from_list(Tab* tab)
// Update UI / Tabs to reflect changes in the currently loaded presets
void GUI_App::load_current_presets()
{
for (Tab *tab : tabs_list) {
tab->load_current_preset();
}
PrinterTechnology printer_technology = preset_bundle->printers.get_edited_preset().printer_technology();
for (Tab *tab : tabs_list)
if (tab->supports_printer_technology(printer_technology)) {
if (tab->name() == "printer")
static_cast<TabPrinter*>(tab)->update_pages();
tab->load_current_preset();
}
}
Sidebar& GUI_App::sidebar()

View File

@ -971,10 +971,8 @@ void ObjectList::split(const bool split_part)
m_parts_changed = true;
parts_changed(m_selected_object_id);
#if ENABLE_EXTENDED_SELECTION
// restores selection
_3DScene::get_canvas(wxGetApp().canvas3D())->get_selection().add_object(m_selected_object_id);
#endif // ENABLE_EXTENDED_SELECTION
}
bool ObjectList::get_volume_by_item(const bool split_part, const wxDataViewItem& item, ModelVolume*& volume)
@ -1082,11 +1080,7 @@ void ObjectList::part_selection_changed()
m_selected_object_id = obj_idx;
#if ENABLE_EXTENDED_SELECTION
wxGetApp().obj_manipul()->update_settings_value(_3DScene::get_canvas(wxGetApp().canvas3D())->get_selection());
#else
wxGetApp().obj_manipul()->update_values();
#endif // ENABLE_EXTENDED_SELECTION
}
void ObjectList::update_manipulation_sizer(const bool is_simple_mode)
@ -1105,9 +1099,6 @@ void ObjectList::add_object_to_list(size_t obj_idx)
auto model_object = (*m_objects)[obj_idx];
wxString item_name = model_object->name;
auto item = m_objects_model->Add(item_name);
#if !ENABLE_EXTENDED_SELECTION
/*Select*/select_item(item);
#endif // !ENABLE_EXTENDED_SELECTION
// Add error icon if detected auto-repaire
auto stats = model_object->volumes[0]->mesh.stl.stats;
@ -1235,7 +1226,6 @@ bool ObjectList::multiple_selection() const
void ObjectList::update_selections()
{
#if ENABLE_EXTENDED_SELECTION
auto& selection = _3DScene::get_canvas(wxGetApp().canvas3D())->get_selection();
wxDataViewItemArray sels;
@ -1245,13 +1235,10 @@ void ObjectList::update_selections()
sels.Add(m_objects_model->GetItemByVolumeId(gl_vol->object_idx(), gl_vol->volume_idx()));
}
select_items(sels);
#endif // ENABLE_EXTENDED_SELECTION
}
void ObjectList::update_selections_on_canvas()
{
#if ENABLE_EXTENDED_SELECTION
auto& selection = _3DScene::get_canvas(wxGetApp().canvas3D())->get_selection();
const int sel_cnt = GetSelectedItemsCount();
@ -1299,8 +1286,6 @@ void ObjectList::update_selections_on_canvas()
add_to_selection(item, selection, false);
_3DScene::render(wxGetApp().canvas3D());
#endif // ENABLE_EXTENDED_SELECTION
}
void ObjectList::select_item(const wxDataViewItem& item)

View File

@ -266,7 +266,6 @@ void ObjectManipulation::update_settings_list()
parent->GetParent()->Layout();
}
#if ENABLE_EXTENDED_SELECTION
void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& selection)
{
if (selection.is_single_full_object())
@ -344,7 +343,6 @@ void ObjectManipulation::reset_scale_value()
m_og->set_value("scale_y", 100);
m_og->set_value("scale_z", 100);
}
#endif // ENABLE_EXTENDED_SELECTION
void ObjectManipulation::update_values()
{

View File

@ -6,9 +6,7 @@
#include <wx/panel.h>
#include "Preset.hpp"
#if ENABLE_EXTENDED_SELECTION
#include "GLCanvas3D.hpp"
#endif // ENABLE_EXTENDED_SELECTION
class wxBoxSizer;
@ -16,7 +14,6 @@ namespace Slic3r {
namespace GUI {
class ConfigOptionsGroup;
class OG_Settings
{
protected:
@ -47,13 +44,11 @@ public:
int ol_selection();
void update_settings_list();
#if ENABLE_EXTENDED_SELECTION
void update_settings_value(const GLCanvas3D::Selection& selection);
void reset_settings_value();
void reset_position_value();
void reset_rotation_value();
void reset_scale_value();
#endif // ENABLE_EXTENDED_SELECTION
void update_values();
// update position values displacements or "gizmos"

View File

@ -444,7 +444,7 @@ struct Sidebar::priv
void Sidebar::priv::show_preset_comboboxes()
{
const bool showSLA = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA;
const bool showSLA = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
wxWindowUpdateLocker noUpdates(wxGetApp().mainframe);
@ -588,40 +588,49 @@ void Sidebar::remove_unused_filament_combos(const int current_extruder_count)
void Sidebar::update_presets(Preset::Type preset_type)
{
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
switch (preset_type) {
case Preset::TYPE_FILAMENT:
if (p->combos_filament.size() == 1) {
// Single filament printer, synchronize the filament presets.
const std::string &name = wxGetApp().preset_bundle->filaments.get_selected_preset().name;
wxGetApp().preset_bundle->set_filament_preset(0, name);
const std::string &name = preset_bundle.filaments.get_selected_preset().name;
preset_bundle.set_filament_preset(0, name);
}
for (size_t i = 0; i < p->combos_filament.size(); i++) {
wxGetApp().preset_bundle->update_platter_filament_ui(i, p->combos_filament[i]);
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
}
break;
case Preset::TYPE_PRINT:
wxGetApp().preset_bundle->prints.update_platter_ui(p->combo_print);
preset_bundle.prints.update_platter_ui(p->combo_print);
break;
case Preset::TYPE_SLA_MATERIAL:
wxGetApp().preset_bundle->sla_materials.update_platter_ui(p->combo_sla_material);
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
break;
case Preset::TYPE_PRINTER:
// Update the print choosers to only contain the compatible presets, update the dirty flags.
wxGetApp().preset_bundle->prints.update_platter_ui(p->combo_print);
// Update the printer choosers, update the dirty flags.
wxGetApp().preset_bundle->printers.update_platter_ui(p->combo_printer);
// Update the filament choosers to only contain the compatible presets, update the color preview,
// update the dirty flags.
for (size_t i = 0; i < p->combos_filament.size(); i++) {
wxGetApp().preset_bundle->update_platter_filament_ui(i, p->combos_filament[i]);
}
p->show_preset_comboboxes();
break;
case Preset::TYPE_PRINTER:
{
PrinterTechnology printer_technology = preset_bundle.printers.get_edited_preset().printer_technology();
// Update the print choosers to only contain the compatible presets, update the dirty flags.
if (printer_technology == ptFFF)
preset_bundle.prints.update_platter_ui(p->combo_print);
else
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
// Update the printer choosers, update the dirty flags.
preset_bundle.printers.update_platter_ui(p->combo_printer);
// Update the filament choosers to only contain the compatible presets, update the color preview,
// update the dirty flags.
if (printer_technology == ptFFF) {
for (size_t i = 0; i < p->combos_filament.size(); ++ i)
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
}
p->show_preset_comboboxes();
break;
}
default: break;
}
@ -808,18 +817,6 @@ std::vector<PresetComboBox*>& Sidebar::combos_filament()
return p->combos_filament;
}
#if !ENABLE_EXTENDED_SELECTION
// Plater::Object
struct PlaterObject
{
std::string name;
bool selected;
PlaterObject(std::string name) : name(std::move(name)), selected(false) {}
};
#endif // !ENABLE_EXTENDED_SELECTION
// Plater::DropTarget
class PlaterDropTarget : public wxFileDropTarget
@ -871,9 +868,6 @@ struct Plater::priv
Slic3r::Print print;
Slic3r::Model model;
Slic3r::GCodePreviewData gcode_preview_data;
#if !ENABLE_EXTENDED_SELECTION
std::vector<PlaterObject> objects;
#endif // !ENABLE_EXTENDED_SELECTION
// GUI elements
wxNotebook *notebook;
@ -889,9 +883,6 @@ struct Plater::priv
priv(Plater *q, MainFrame *main_frame);
#if !ENABLE_EXTENDED_SELECTION
std::vector<int> collect_selections();
#endif // !ENABLE_EXTENDED_SELECTION
void update(bool force_autocenter = false);
void select_view(const std::string& direction);
void update_ui_from_settings();
@ -903,30 +894,15 @@ struct Plater::priv
std::vector<size_t> load_model_objects(const ModelObjectPtrs &model_objects);
std::unique_ptr<CheckboxFileDialog> get_export_file(GUI::FileType file_type);
#if ENABLE_EXTENDED_SELECTION
const GLCanvas3D::Selection& get_selection() const;
GLCanvas3D::Selection& get_selection();
int get_selected_object_idx() const;
#else
void select_object(optional<size_t> obj_idx);
void select_object_from_cpp();
optional<size_t> selected_object() const;
#endif // ENABLE_EXTENDED_SELECTION
void selection_changed();
void object_list_changed();
#if !ENABLE_EXTENDED_SELECTION
void select_view();
#endif // !ENABLE_EXTENDED_SELECTION
void remove(size_t obj_idx);
void reset();
#if !ENABLE_EXTENDED_SELECTION
void rotate();
#endif // !ENABLE_EXTENDED_SELECTION
void mirror(Axis axis);
#if !ENABLE_EXTENDED_SELECTION
void scale();
#endif // !ENABLE_EXTENDED_SELECTION
void arrange();
void split_object();
void split_volume();
@ -950,25 +926,12 @@ struct Plater::priv
void on_action_split_objects(SimpleEvent&);
void on_action_split_volumes(SimpleEvent&);
void on_action_cut(SimpleEvent&);
#if !ENABLE_EXTENDED_SELECTION
void on_action_settings(SimpleEvent&);
#endif // !ENABLE_EXTENDED_SELECTION
void on_action_layersediting(SimpleEvent&);
#if !ENABLE_EXTENDED_SELECTION
void on_action_selectbyparts(SimpleEvent&);
#endif // !ENABLE_EXTENDED_SELECTION
#if ENABLE_EXTENDED_SELECTION
void on_object_select(SimpleEvent&);
#else
void on_object_select(ObjectSelectEvent&);
#endif // ENABLE_EXTENDED_SELECTION
void on_viewport_changed(SimpleEvent&);
void on_right_click(Vec2dEvent&);
void on_model_update(SimpleEvent&);
#if !ENABLE_EXTENDED_SELECTION
void on_scale_uniformly(SimpleEvent&);
#endif // !ENABLE_EXTENDED_SELECTION
void on_wipetower_moved(Vec3dEvent&);
void on_enable_action_buttons(Event<bool>&);
void on_update_geometry(Vec3dsEvent<2>&);
@ -976,7 +939,6 @@ struct Plater::priv
private:
bool init_object_menu();
#if ENABLE_EXTENDED_SELECTION
bool can_delete_object() const;
bool can_increase_instances() const;
bool can_decrease_instances() const;
@ -986,10 +948,7 @@ private:
bool layers_height_allowed() const;
bool can_delete_all() const;
bool can_arrange() const;
#if ENABLE_MIRROR
bool can_mirror() const;
#endif // ENABLE_MIRROR
#endif // ENABLE_EXTENDED_SELECTION
};
const std::regex Plater::priv::pattern_bundle(".*[.](amf|amf[.]xml|zip[.]amf|3mf|prusa)", std::regex::icase);
@ -1032,10 +991,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) :
_3DScene::enable_picking(canvas3D, true);
_3DScene::enable_moving(canvas3D, true);
// XXX: more config from 3D.pm
#if !ENABLE_EXTENDED_SELECTION
_3DScene::set_select_by(canvas3D, "object");
_3DScene::set_drag_by(canvas3D, "instance");
#endif // !ENABLE_EXTENDED_SELECTION
_3DScene::set_model(canvas3D, &model);
_3DScene::set_print(canvas3D, &print);
_3DScene::set_config(canvas3D, config);
@ -1075,17 +1030,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) :
canvas3D->Bind(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, &priv::on_schedule_background_process, this);
canvas3D->Bind(EVT_GLCANVAS_OBJECT_SELECT, &priv::on_object_select, this);
canvas3D->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this);
#if !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLCANVAS_DOUBLE_CLICK, [](SimpleEvent&) {}); // XXX: remove?
#endif // !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLCANVAS_RIGHT_CLICK, &priv::on_right_click, this);
canvas3D->Bind(EVT_GLCANVAS_MODEL_UPDATE, &priv::on_model_update, this);
canvas3D->Bind(EVT_GLCANVAS_REMOVE_OBJECT, [q](SimpleEvent&) { q->remove_selected(); });
canvas3D->Bind(EVT_GLCANVAS_ARRANGE, [this](SimpleEvent&) { arrange(); });
#if !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLCANVAS_ROTATE_OBJECT, [this](Event<int> &evt) { /*TODO: call rotate */ });
canvas3D->Bind(EVT_GLCANVAS_SCALE_UNIFORMLY, [this](SimpleEvent&) { this->scale(); });
#endif // !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLCANVAS_INCREASE_INSTANCES, [q](Event<int> &evt) { evt.data == 1 ? q->increase_instances() : q->decrease_instances(); });
canvas3D->Bind(EVT_GLCANVAS_INSTANCE_MOVED, [this](SimpleEvent&) { update(); });
canvas3D->Bind(EVT_GLCANVAS_WIPETOWER_MOVED, &priv::on_wipetower_moved, this);
@ -1101,13 +1049,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) :
canvas3D->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this);
canvas3D->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this);
canvas3D->Bind(EVT_GLTOOLBAR_CUT, &priv::on_action_cut, this);
#if !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLTOOLBAR_SETTINGS, &priv::on_action_settings, this);
#endif // !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this);
#if !ENABLE_EXTENDED_SELECTION
canvas3D->Bind(EVT_GLTOOLBAR_SELECTBYPARTS, &priv::on_action_selectbyparts, this);
#endif // !ENABLE_EXTENDED_SELECTION
// Preview events:
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this);
@ -1122,17 +1064,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) :
q->Layout();
}
#if !ENABLE_EXTENDED_SELECTION
std::vector<int> Plater::priv::collect_selections()
{
std::vector<int> res;
for (const auto &obj : objects) {
res.push_back(obj.selected);
}
return res;
}
#endif // !ENABLE_EXTENDED_SELECTION
void Plater::priv::update(bool force_autocenter)
{
wxWindowUpdateLocker freeze_guard(q);
@ -1144,10 +1075,6 @@ void Plater::priv::update(bool force_autocenter)
model.center_instances_around_point(bed_center);
}
#if !ENABLE_EXTENDED_SELECTION
const auto selections = collect_selections();
_3DScene::set_objects_selections(canvas3D, selections);
#endif // !ENABLE_EXTENDED_SELECTION
_3DScene::reload_scene(canvas3D, false);
preview->reset_gcode_preview_data();
preview->reload_print();
@ -1319,19 +1246,12 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
bool need_arrange = false;
bool scaled_down = false;
std::vector<size_t> obj_idxs;
#if ENABLE_EXTENDED_SELECTION
unsigned int obj_count = model.objects.size();
#endif // ENABLE_EXTENDED_SELECTION
for (ModelObject *model_object : model_objects) {
auto *object = model.add_object(*model_object);
std::string object_name = object->name.empty() ? fs::path(object->input_file).filename().string() : object->name;
#if ENABLE_EXTENDED_SELECTION
obj_idxs.push_back(obj_count++);
#else
objects.emplace_back(std::move(object_name));
obj_idxs.push_back(objects.size() - 1);
#endif // ENABLE_EXTENDED_SELECTION
if (model_object->instances.empty()) {
// if object has no defined position(s) we need to rearrange everything after loading
@ -1443,7 +1363,6 @@ std::unique_ptr<CheckboxFileDialog> Plater::priv::get_export_file(GUI::FileType
return dlg;
}
#if ENABLE_EXTENDED_SELECTION
const GLCanvas3D::Selection& Plater::priv::get_selection() const
{
return _3DScene::get_canvas(canvas3D)->get_selection();
@ -1459,43 +1378,9 @@ int Plater::priv::get_selected_object_idx() const
int idx = get_selection().get_object_idx();
return ((0 <= idx) && (idx < 1000)) ? idx : -1;
}
#else
void Plater::priv::select_object(optional<size_t> obj_idx)
{
for (auto &obj : objects) {
obj.selected = false;
}
if (obj_idx) {
objects[*obj_idx].selected = true;
}
selection_changed();
}
void Plater::priv::select_object_from_cpp()
{
// TODO
}
optional<size_t> Plater::priv::selected_object() const
{
for (size_t i = 0; i < objects.size(); i++) {
if (objects[i].selected) { return i; }
}
return boost::none;
}
#endif // ENABLE_EXTENDED_SELECTION
void Plater::priv::selection_changed()
{
#if !ENABLE_EXTENDED_SELECTION
const auto obj_idx = selected_object();
const bool have_sel = !!obj_idx;
#endif // !ENABLE_EXTENDED_SELECTION
#if ENABLE_EXTENDED_SELECTION
_3DScene::enable_toolbar_item(canvas3D, "delete", can_delete_object());
_3DScene::enable_toolbar_item(canvas3D, "more", can_increase_instances());
_3DScene::enable_toolbar_item(canvas3D, "fewer", can_decrease_instances());
@ -1505,68 +1390,66 @@ void Plater::priv::selection_changed()
_3DScene::enable_toolbar_item(canvas3D, "layersediting", layers_height_allowed());
// forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
_3DScene::render(canvas3D);
#else
_3DScene::enable_toolbar_item(canvas3D, "fewer", have_sel);
_3DScene::enable_toolbar_item(canvas3D, "splitobjects", have_sel);
_3DScene::enable_toolbar_item(canvas3D, "splitvolumes", have_sel);
_3DScene::enable_toolbar_item(canvas3D, "cut", have_sel);
_3DScene::enable_toolbar_item(canvas3D, "settings", have_sel);
_3DScene::enable_toolbar_item(canvas3D, "layersediting", have_sel && config->opt_bool("variable_layer_height") && _3DScene::is_layers_editing_allowed(canvas3D));
#endif // ENABLE_EXTENDED_SELECTION
#if !ENABLE_EXTENDED_SELECTION
bool can_select_by_parts = false;
wxWindowUpdateLocker freeze_guard(sidebar);
if (have_sel) {
const auto *model_object = model.objects[*obj_idx];
// XXX: ?
can_select_by_parts = *obj_idx < 1000 && model_object->volumes.size() > 1;
_3DScene::enable_toolbar_item(canvas3D, "fewer", model_object->instances.size() > 1);
}
const ModelObject* model_object = model.objects[obj_idx];
// FIXME print_info runs model fixing in two rounds, it is very slow, it should not be performed here!
// # $model_object->print_info;
if (can_select_by_parts) {
// first disable to let the item in the toolbar to switch to the unpressed state // XXX: ?
_3DScene::enable_toolbar_item(canvas3D, "selectbyparts", false);
_3DScene::enable_toolbar_item(canvas3D, "selectbyparts", true);
const ModelInstance* model_instance = !model_object->instances.empty() ? model_object->instances.front() : nullptr;
// TODO
// $self->{object_info_size}->SetLabel(sprintf("%.2f x %.2f x %.2f", @{$model_object->instance_bounding_box(0)->size}));
// $self->{object_info_materials}->SetLabel($model_object->materials_count);
// if (my $stats = $model_object->mesh_stats) {
// $self->{object_info_volume}->SetLabel(sprintf('%.2f', $stats->{volume} * ($model_instance->scaling_factor**3)));
// $self->{object_info_facets}->SetLabel(sprintf(L('%d (%d shells)'), $model_object->facets_count, $stats->{number_of_parts}));
// if (my $errors = sum(@$stats{qw(degenerate_facets edges_fixed facets_removed facets_added facets_reversed backwards_edges)})) {
// $self->{object_info_manifold}->SetLabel(sprintf(L("Auto-repaired (%d errors)"), $errors));
// #$self->{object_info_manifold_warning_icon}->Show;
// $self->{"object_info_manifold_warning_icon_show"}->(1);
// # we don't show normals_fixed because we never provide normals
// # to admesh, so it generates normals for all facets
// my $message = sprintf L('%d degenerate facets, %d edges fixed, %d facets removed, %d facets added, %d facets reversed, %d backwards edges'),
// @$stats{qw(degenerate_facets edges_fixed facets_removed facets_added facets_reversed backwards_edges)};
// $self->{object_info_manifold}->SetToolTipString($message);
// $self->{object_info_manifold_warning_icon}->SetToolTipString($message);
// } else {
// $self->{object_info_manifold}->SetLabel(L("Yes"));
// #$self->{object_info_manifold_warning_icon}->Hide;
// $self->{"object_info_manifold_warning_icon_show"}->(0);
// $self->{object_info_manifold}->SetToolTipString("");
// $self->{object_info_manifold_warning_icon}->SetToolTipString("");
// }
// } else {
// $self->{object_info_facets}->SetLabel($object->facets);
// }
} else {
_3DScene::enable_toolbar_item(canvas3D, "selectbyparts", false);
_3DScene::set_select_by(canvas3D, "object");
// $self->{"object_info_$_"}->SetLabel("") for qw(size volume facets materials manifold);
// $self->{"object_info_manifold_warning_icon_show"}->(0);
// $self->{object_info_manifold}->SetToolTipString("");
// $self->{object_info_manifold_warning_icon}->SetToolTipString("");
}
#endif // ENABLE_EXTENDED_SELECTION
sidebar->show_info_sizer();
q->Layout();
}
void Plater::priv::object_list_changed()
{
// Enable/disable buttons depending on whether there are any objects on the platter.
#if ENABLE_EXTENDED_SELECTION
_3DScene::enable_toolbar_item(canvas3D, "deleteall", can_delete_all());
_3DScene::enable_toolbar_item(canvas3D, "arrange", can_arrange());
#else
const bool have_objects = !objects.empty();
_3DScene::enable_toolbar_item(canvas3D, "deleteall", have_objects);
_3DScene::enable_toolbar_item(canvas3D, "arrange", have_objects);
#endif // ENABLE_EXTENDED_SELECTION
const bool export_in_progress = this->background_process.is_export_scheduled(); // || ! send_gcode_file.empty());
// XXX: is this right?
const bool model_fits = _3DScene::check_volumes_outside_state(canvas3D, config) == ModelInstance::PVS_Inside;
#if ENABLE_EXTENDED_SELECTION
sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits);
#else
sidebar->enable_buttons(have_objects && !export_in_progress && model_fits);
#endif // ENABLE_EXTENDED_SELECTION
}
#if !ENABLE_EXTENDED_SELECTION
void Plater::priv::select_view()
{
// TODO
}
#endif // !ENABLE_EXTENDED_SELECTION
void Plater::priv::remove(size_t obj_idx)
{
// Prevent toolpaths preview from rendering while we modify the Print object
@ -1575,19 +1458,12 @@ void Plater::priv::remove(size_t obj_idx)
if (_3DScene::is_layers_editing_enabled(canvas3D))
_3DScene::enable_layers_editing(canvas3D, false);
#if !ENABLE_EXTENDED_SELECTION
objects.erase(objects.begin() + obj_idx);
#endif // !ENABLE_EXTENDED_SELECTION
model.delete_object(obj_idx);
// print.delete_object(obj_idx);
// Delete object from Sidebar list
sidebar->obj_list()->delete_object_from_list(obj_idx);
object_list_changed();
#if !ENABLE_EXTENDED_SELECTION
select_object(boost::none);
#endif // !ENABLE_EXTENDED_SELECTION
update();
}
@ -1599,72 +1475,20 @@ void Plater::priv::reset()
if (_3DScene::is_layers_editing_enabled(canvas3D))
_3DScene::enable_layers_editing(canvas3D, false);
#if !ENABLE_EXTENDED_SELECTION
objects.clear();
#endif // !ENABLE_EXTENDED_SELECTION
model.clear_objects();
// print.clear_objects();
// Delete all objects from list on c++ side
sidebar->obj_list()->delete_all_objects_from_list();
object_list_changed();
#if !ENABLE_EXTENDED_SELECTION
select_object(boost::none);
#endif // !ENABLE_EXTENDED_SELECTION
update();
}
#if !ENABLE_EXTENDED_SELECTION
void Plater::priv::rotate()
{
// TODO
}
#endif // !ENABLE_EXTENDED_SELECTION
void Plater::priv::mirror(Axis axis)
{
#if ENABLE_MIRROR
#if ENABLE_EXTENDED_SELECTION
_3DScene::mirror_selection(canvas3D, axis);
#endif // ENABLE_EXTENDED_SELECTION
#else
#if ENABLE_EXTENDED_SELECTION
int obj_idx = get_selected_object_idx();
if (obj_idx == -1)
return;
ModelObject* model_object = model.objects[obj_idx];
ModelInstance* model_instance = model_object->instances.front();
#else
const auto obj_idx = selected_object();
if (! obj_idx) { return; }
auto *model_object = model.objects[*obj_idx];
auto *model_instance = model_object->instances[0];
#endif // ENABLE_EXTENDED_SELECTION
// XXX: ?
// # apply Z rotation before mirroring
// if ($model_instance->rotation != 0) {
// $model_object->rotate($model_instance->rotation, Slic3r::Pointf3->new(0, 0, 1));
// $_->set_rotation(0) for @{ $model_object->instances };
// }
model_object->mirror(axis);
selection_changed();
update();
#endif // ENABLE_MIRROR
}
#if !ENABLE_EXTENDED_SELECTION
void Plater::priv::scale()
{
// TODO
}
#endif // !ENABLE_EXTENDED_SELECTION
void Plater::priv::arrange()
{
main_frame->app_controller()->arrange_model();
@ -1677,7 +1501,6 @@ void Plater::priv::arrange()
void Plater::priv::split_object()
{
#if ENABLE_EXTENDED_SELECTION
int obj_idx = get_selected_object_idx();
if (obj_idx == -1)
return;
@ -1721,7 +1544,6 @@ void Plater::priv::split_object()
get_selection().add_object((unsigned int)idx, false);
}
}
#endif // ENABLE_EXTENDED_SELECTION
}
void Plater::priv::split_volume()
@ -1761,11 +1583,9 @@ void Plater::priv::async_apply_config()
this->preview->reload_print();
// We also need to reload 3D scene because of the wipe tower preview box
if (this->config->opt_bool("wipe_tower")) {
#if !ENABLE_EXTENDED_SELECTION
std::vector<int> selections = this->collect_selections();
Slic3r::_3DScene::set_objects_selections(this->canvas3D, selections);
Slic3r::_3DScene::reload_scene(this->canvas3D, 1);
#endif /* !ENABLE_EXTENDED_SELECTION */
// std::vector<int> selections = this->collect_selections();
// Slic3r::_3DScene::set_objects_selections(this->canvas3D, selections);
// Slic3r::_3DScene::reload_scene(this->canvas3D, 1);
}
}
if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->get_config("background_processing") == "1" &&
@ -1839,9 +1659,6 @@ void Plater::priv::on_notebook_changed(wxBookCtrlEvent&)
const auto current_id = notebook->GetCurrentPage()->GetId();
if (current_id == canvas3D->GetId()) {
if (_3DScene::is_reload_delayed(canvas3D)) {
#if !ENABLE_EXTENDED_SELECTION
_3DScene::set_objects_selections(canvas3D, collect_selections());
#endif // !ENABLE_EXTENDED_SELECTION
_3DScene::reload_scene(canvas3D, true);
}
// sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
@ -1903,12 +1720,10 @@ void Plater::priv::on_update_print_preview(wxCommandEvent &)
if (this->preview != nullptr)
this->preview->reload_print();
// in case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth:
#if !ENABLE_EXTENDED_SELECTION
auto selections = collect_selections();
_3DScene::set_objects_selections(canvas3D, selections);
if (canvas3D)
_3DScene::reload_scene(canvas3D, true);
#endif // !ENABLE_EXTENDED_SELECTION
// auto selections = collect_selections();
// _3DScene::set_objects_selections(canvas3D, selections);
// if (canvas3D)
// _3DScene::reload_scene(canvas3D, true);
}
void Plater::priv::on_process_completed(wxCommandEvent &evt)
@ -1980,13 +1795,6 @@ void Plater::priv::on_action_cut(SimpleEvent&)
// TODO
}
#if !ENABLE_EXTENDED_SELECTION
void Plater::priv::on_action_settings(SimpleEvent&)
{
// TODO
}
#endif // !ENABLE_EXTENDED_SELECTION
void Plater::priv::on_action_layersediting(SimpleEvent&)
{
bool enable = !_3DScene::is_layers_editing_enabled(canvas3D);
@ -1995,31 +1803,11 @@ void Plater::priv::on_action_layersediting(SimpleEvent&)
_3DScene::enable_toolbar_item(canvas3D, "layersediting", false);
}
#if !ENABLE_EXTENDED_SELECTION
void Plater::priv::on_action_selectbyparts(SimpleEvent&)
{
// TODO
}
#endif // !ENABLE_EXTENDED_SELECTION
#if ENABLE_EXTENDED_SELECTION
void Plater::priv::on_object_select(SimpleEvent& evt)
{
selection_changed();
wxGetApp().obj_list()->update_selections();
}
#else
void Plater::priv::on_object_select(ObjectSelectEvent &evt)
{
const auto obj_idx = evt.object_id();
const auto vol_idx = evt.volume_id();
if (obj_idx >= 0 && obj_idx < 1000 && vol_idx == -1) {
// Ignore the special objects (the wipe tower proxy and such).
select_object(obj_idx);
}
}
#endif // ENABLE_EXTENDED_SELECTION
void Plater::priv::on_viewport_changed(SimpleEvent& evt)
{
@ -2032,16 +1820,12 @@ void Plater::priv::on_viewport_changed(SimpleEvent& evt)
void Plater::priv::on_right_click(Vec2dEvent& evt)
{
#if ENABLE_EXTENDED_SELECTION
int obj_idx = get_selected_object_idx();
if (obj_idx == -1)
return;
if (q != nullptr)
q->PopupMenu(&object_menu, (int)evt.data.x(), (int)evt.data.y());
#else
// TODO
#endif // ENABLE_EXTENDED_SELECTION
}
void Plater::priv::on_model_update(SimpleEvent&)
@ -2049,42 +1833,6 @@ void Plater::priv::on_model_update(SimpleEvent&)
// TODO
}
#if !ENABLE_EXTENDED_SELECTION
void Plater::priv::on_scale_uniformly(SimpleEvent&)
{
// my ($scale) = @_;
// my ($obj_idx, $object) = $self->selected_object;
const auto obj_idx = selected_object();
if (! obj_idx) { return; }
// return if !defined $obj_idx;
// my $model_object = $self->{model}->objects->[$obj_idx];
// my $model_instance = $model_object->instances->[0];
// my $variation = $scale / $model_instance->scaling_factor;
// #FIXME Scale the layer height profile?
// foreach my $range (@{ $model_object->layer_height_ranges }) {
// $range->[0] *= $variation;
// $range->[1] *= $variation;
// }
// $_->set_scaling_factor($scale) for @{ $model_object->instances };
// # Set object scale on c++ side
// # Slic3r::GUI::set_object_scale($obj_idx, $model_object->instances->[0]->scaling_factor * 100);
// # $object->transform_thumbnail($self->{model}, $obj_idx);
// #update print and start background processing
// $self->{print}->add_model_object($model_object, $obj_idx);
// $self->selection_changed(1); # refresh info (size, volume etc.)
// $self->update;
this->schedule_background_process();
}
#endif // !ENABLE_EXTENDED_SELECTION
void Plater::priv::on_wipetower_moved(Vec3dEvent &evt)
{
DynamicPrintConfig cfg;
@ -2116,7 +1864,6 @@ bool Plater::priv::init_object_menu()
object_menu.AppendSeparator();
#if ENABLE_MIRROR
wxMenu* mirror_menu = new wxMenu();
if (mirror_menu == nullptr)
return false;
@ -2129,7 +1876,6 @@ bool Plater::priv::init_object_menu()
[this](wxCommandEvent&) { mirror(Z); }, "bullet_blue.png", &object_menu);
wxMenuItem* item_mirror = append_submenu(&object_menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object")));
#endif // ENABLE_MIRROR
wxMenu* split_menu = new wxMenu();
if (split_menu == nullptr)
@ -2142,13 +1888,10 @@ bool Plater::priv::init_object_menu()
wxMenuItem* item_split = append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object")), "shape_ungroup.png");
#if ENABLE_EXTENDED_SELECTION
// ui updates needs to be binded to the parent panel
if (q != nullptr)
{
#if ENABLE_MIRROR
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId());
#endif // ENABLE_MIRROR
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_object()); }, item_delete->GetId());
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId());
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId());
@ -2157,12 +1900,10 @@ bool Plater::priv::init_object_menu()
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split_objects->GetId());
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); }, item_split_volumes->GetId());
}
#endif // ENABLE_EXTENDED_SELECTION
return true;
}
#if ENABLE_EXTENDED_SELECTION
bool Plater::priv::can_delete_object() const
{
int obj_idx = get_selected_object_idx();
@ -2215,13 +1956,10 @@ bool Plater::priv::can_arrange() const
return !model.objects.empty();
}
#if ENABLE_MIRROR
bool Plater::priv::can_mirror() const
{
return get_selection().is_from_single_instance();
}
#endif // ENABLE_MIRROR
#endif // ENABLE_EXTENDED_SELECTION
// Plater / Public
@ -2262,51 +2000,28 @@ void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
void Plater::remove_selected()
{
#if ENABLE_EXTENDED_SELECTION
int obj_idx = p->get_selected_object_idx();
if (obj_idx != -1)
remove((size_t)obj_idx);
#else
const auto selected = p->selected_object();
if (selected) {
remove(*selected);
}
#endif // ENABLE_EXTENDED_SELECTION
}
void Plater::increase_instances(size_t num)
{
#if ENABLE_EXTENDED_SELECTION
int obj_idx = p->get_selected_object_idx();
if (obj_idx == -1)
return;
ModelObject* model_object = p->model.objects[obj_idx];
ModelInstance* model_instance = model_object->instances.back();
#else
const auto obj_idx = p->selected_object();
if (! obj_idx) { return; }
auto *model_object = p->model.objects[*obj_idx];
auto *model_instance = model_object->instances[model_object->instances.size() - 1];
#endif // ENABLE_EXTENDED_SELECTION
float offset = 10.0;
for (size_t i = 0; i < num; i++, offset += 10.0) {
Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0);
model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation());
#if ENABLE_EXTENDED_SELECTION
// p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec));
#else
// p->print.get_object(*obj_idx)->add_copy(Slic3r::to_2d(offset_vec));
#endif // ENABLE_EXTENDED_SELECTION
}
#if ENABLE_EXTENDED_SELECTION
sidebar().obj_list()->increase_object_instances(obj_idx, num);
#else
sidebar().obj_list()->increase_object_instances(*obj_idx, num);
#endif // ENABLE_EXTENDED_SELECTION
if (p->get_config("autocenter") == "1") {
p->arrange();
@ -2314,9 +2029,7 @@ void Plater::increase_instances(size_t num)
p->update();
}
#if ENABLE_EXTENDED_SELECTION
p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1);
#endif // ENABLE_EXTENDED_SELECTION
p->selection_changed();
@ -2325,47 +2038,26 @@ void Plater::increase_instances(size_t num)
void Plater::decrease_instances(size_t num)
{
#if ENABLE_EXTENDED_SELECTION
int obj_idx = p->get_selected_object_idx();
if (obj_idx == -1)
return;
ModelObject* model_object = p->model.objects[obj_idx];
#else
const auto obj_idx = p->selected_object();
if (! obj_idx) { return; }
auto *model_object = p->model.objects[*obj_idx];
#endif // ENABLE_EXTENDED_SELECTION
if (model_object->instances.size() > num) {
for (size_t i = 0; i < num; i++) {
model_object->delete_last_instance();
#if ENABLE_EXTENDED_SELECTION
// p->print.get_object(obj_idx)->delete_last_copy();
#else
// p->print.get_object(*obj_idx)->delete_last_copy();
#endif // ENABLE_EXTENDED_SELECTION
}
#if ENABLE_EXTENDED_SELECTION
sidebar().obj_list()->decrease_object_instances(obj_idx, num);
#else
sidebar().obj_list()->decrease_object_instances(*obj_idx, num);
#endif // ENABLE_EXTENDED_SELECTION
}
else {
#if ENABLE_EXTENDED_SELECTION
remove(obj_idx);
#else
remove(*obj_idx);
#endif // ENABLE_EXTENDED_SELECTION
}
p->update();
#if ENABLE_EXTENDED_SELECTION
if (!model_object->instances.empty())
p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1);
#endif // ENABLE_EXTENDED_SELECTION
p->selection_changed();
this->p->schedule_background_process();
@ -2373,18 +2065,11 @@ void Plater::decrease_instances(size_t num)
void Plater::set_number_of_copies(/*size_t num*/)
{
#if ENABLE_EXTENDED_SELECTION
int obj_idx = p->get_selected_object_idx();
if (obj_idx == -1)
return;
ModelObject* model_object = p->model.objects[obj_idx];
#else
const auto obj_idx = p->selected_object();
if (! obj_idx) { return; }
auto *model_object = p->model.objects[*obj_idx];
#endif // ENABLE_EXTENDED_SELECTION
const auto num = wxGetNumberFromUser( " ", _("Enter the number of copies:"),
_("Copies of the selected object"), model_object->instances.size(), 0, 1000, this );
@ -2400,13 +2085,8 @@ void Plater::set_number_of_copies(/*size_t num*/)
void Plater::export_gcode(fs::path output_path)
{
#if ENABLE_EXTENDED_SELECTION
if (p->model.objects.empty())
return;
#else
if (p->objects.empty())
return;
#endif // ENABLE_EXTENDED_SELECTION
if (this->p->background_process.is_export_scheduled()) {
GUI::show_error(this, _(L("Another export job is currently running.")));
@ -2458,11 +2138,7 @@ void Plater::export_gcode(fs::path output_path)
void Plater::export_stl()
{
#if ENABLE_EXTENDED_SELECTION
if (p->model.objects.empty()) { return; }
#else
if (p->objects.empty()) { return; }
#endif // ENABLE_EXTENDED_SELECTION
auto dialog = p->get_export_file(FT_STL);
if (! dialog) { return; }
@ -2477,11 +2153,7 @@ void Plater::export_stl()
void Plater::export_amf()
{
#if ENABLE_EXTENDED_SELECTION
if (p->model.objects.empty()) { return; }
#else
if (p->objects.empty()) { return; }
#endif // ENABLE_EXTENDED_SELECTION
auto dialog = p->get_export_file(FT_AMF);
if (! dialog) { return; }
@ -2500,11 +2172,7 @@ void Plater::export_amf()
void Plater::export_3mf()
{
#if ENABLE_EXTENDED_SELECTION
if (p->model.objects.empty()) { return; }
#else
if (p->objects.empty()) { return; }
#endif // ENABLE_EXTENDED_SELECTION
auto dialog = p->get_export_file(FT_3MF);
if (! dialog) { return; }
@ -2649,11 +2317,6 @@ void Plater::changed_object(int obj_idx)
// update print
if (list->is_parts_changed() || list->is_part_settings_changed()) {
this->p->schedule_background_process();
#if !ENABLE_EXTENDED_SELECTION
if (p->canvas3D) _3DScene::reload_scene(p->canvas3D, true);
auto selections = p->collect_selections();
_3DScene::set_objects_selections(p->canvas3D, selections);
#endif // !ENABLE_EXTENDED_SELECTION
#if !ENABLE_MODIFIED_CAMERA_TARGET
_3DScene::zoom_to_volumes(p->canvas3D);
#endif // !ENABLE_MODIFIED_CAMERA_TARGET

View File

@ -210,23 +210,20 @@ void Preset::normalize(DynamicPrintConfig &config)
}
}
DynamicPrintConfig& Preset::load(const std::vector<std::string> &keys, const StaticPrintConfig &defaults)
std::string Preset::remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config)
{
// Set the configuration from the defaults.
this->config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
if (! this->is_default) {
// Load the preset file, apply preset values on top of defaults.
try {
this->config.load_from_ini(this->file);
Preset::normalize(this->config);
} catch (const std::ifstream::failure &err) {
throw std::runtime_error(std::string("The selected preset cannot be loaded: ") + this->file + "\n\tReason: " + err.what());
} catch (const std::runtime_error &err) {
throw std::runtime_error(std::string("Failed loading the preset file: ") + this->file + "\n\tReason: " + err.what());
std::string incorrect_keys;
for (const std::string &key : config.keys())
if (! default_config.has(key)) {
if (incorrect_keys.empty())
incorrect_keys = key;
else {
incorrect_keys += ", ";
incorrect_keys += key;
}
config.erase(key);
}
}
this->loaded = true;
return this->config;
return incorrect_keys;
}
void Preset::save()
@ -390,6 +387,7 @@ const std::vector<std::string>& Preset::sla_material_options()
"exposure_time", "initial_exposure_time",
"material_correction_printing", "material_correction_curing",
"material_notes",
"default_sla_material_profile",
"compatible_printers",
"compatible_printers_condition", "inherits"
};
@ -436,7 +434,8 @@ void PresetCollection::add_default_preset(const std::vector<std::string> &keys,
{
// Insert just the default preset.
m_presets.emplace_back(Preset(this->type(), preset_name, true));
m_presets.back().load(keys, defaults);
m_presets.back().config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
m_presets.back().loaded = true;
++ m_num_default_presets;
}
@ -446,7 +445,6 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
{
boost::filesystem::path dir = boost::filesystem::canonical(boost::filesystem::path(dir_path) / subdir).make_preferred();
m_dir_path = dir.string();
t_config_option_keys keys = this->default_preset().config.keys();
std::string errors_cummulative;
for (auto &dir_entry : boost::filesystem::directory_iterator(dir))
if (boost::filesystem::is_regular_file(dir_entry.status()) && boost::algorithm::iends_with(dir_entry.path().filename().string(), ".ini")) {
@ -462,8 +460,26 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
try {
Preset preset(m_type, name, false);
preset.file = dir_entry.path().string();
//FIXME One should initialize with SLAFullPrintConfig for the SLA profiles!
preset.load(keys, static_cast<const HostConfig&>(FullPrintConfig::defaults()));
// Load the preset file, apply preset values on top of defaults.
try {
DynamicPrintConfig config;
config.load_from_ini(preset.file);
// Find a default preset for the config. The PrintPresetCollection provides different default preset based on the "printer_technology" field.
const Preset &default_preset = this->default_preset_for(config);
preset.config = default_preset.config;
preset.config.apply(std::move(config));
Preset::normalize(preset.config);
// Report configuration fields, which are misplaced into a wrong group.
std::string incorrect_keys = Preset::remove_invalid_keys(config, default_preset.config);
if (! incorrect_keys.empty())
BOOST_LOG_TRIVIAL(error) << "Error in a preset file: The preset \"" <<
preset.file << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed";
preset.loaded = true;
} catch (const std::ifstream::failure &err) {
throw std::runtime_error(std::string("The selected preset cannot be loaded: ") + preset.file + "\n\tReason: " + err.what());
} catch (const std::runtime_error &err) {
throw std::runtime_error(std::string("Failed loading the preset file: ") + preset.file + "\n\tReason: " + err.what());
}
m_presets.emplace_back(preset);
} catch (const std::runtime_error &err) {
errors_cummulative += err.what();
@ -491,8 +507,8 @@ static bool profile_print_params_same(const DynamicPrintConfig &cfg1, const Dyna
// Following keys are used by the UI, not by the slicing core, therefore they are not important
// when comparing profiles for equality. Ignore them.
for (const char *key : { "compatible_printers", "compatible_printers_condition", "inherits",
"print_settings_id", "filament_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile" })
"print_settings_id", "filament_settings_id", "sla_material_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_material_profile" })
diff.erase(std::remove(diff.begin(), diff.end(), key), diff.end());
// Preset with the same name as stored inside the config exists.
return diff.empty();
@ -718,7 +734,7 @@ size_t PresetCollection::update_compatible_with_printer_internal(const Preset &a
Preset &preset_edited = selected ? m_edited_preset : preset_selected;
if (! preset_edited.update_compatible_with_printer(active_printer, &config) &&
selected && unselect_if_incompatible)
m_idx_selected = (size_t)-1;
m_idx_selected = -1;
if (selected)
preset_selected.is_compatible = preset_edited.is_compatible;
}
@ -1018,4 +1034,10 @@ std::string PresetCollection::path_from_name(const std::string &new_name) const
return (boost::filesystem::path(m_dir_path) / file_name).make_preferred().string();
}
const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConfig &config) const
{
const ConfigOptionEnumGeneric *opt_printer_technology = config.opt<ConfigOptionEnumGeneric>("printer_technology");
return this->default_preset((opt_printer_technology == nullptr || opt_printer_technology->value == 0) ? 0 : 1);
}
} // namespace Slic3r

View File

@ -125,9 +125,6 @@ public:
// Configuration data, loaded from a file, or set from the defaults.
DynamicPrintConfig config;
// Load this profile for the following keys only.
DynamicPrintConfig& load(const std::vector<std::string> &keys, const StaticPrintConfig &defaults);
void save();
// Return a label of this preset, consisting of a name and a "(modified)" suffix, if this preset is dirty.
@ -177,8 +174,10 @@ public:
static const std::vector<std::string>& sla_printer_options();
static const std::vector<std::string>& sla_material_options();
static void update_suffix_modified();
static void normalize(DynamicPrintConfig &config);
static void update_suffix_modified();
static void normalize(DynamicPrintConfig &config);
// Report configuration fields, which are misplaced into a wrong group, remove them from the config.
static std::string remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config);
protected:
friend class PresetCollection;
@ -200,9 +199,11 @@ public:
typedef std::deque<Preset>::iterator Iterator;
typedef std::deque<Preset>::const_iterator ConstIterator;
Iterator begin() { return m_presets.begin() + m_num_default_presets; }
ConstIterator begin() const { return m_presets.begin() + m_num_default_presets; }
ConstIterator begin() const { return m_presets.cbegin() + m_num_default_presets; }
ConstIterator cbegin() const { return m_presets.cbegin() + m_num_default_presets; }
Iterator end() { return m_presets.end(); }
ConstIterator end() const { return m_presets.end(); }
ConstIterator end() const { return m_presets.cend(); }
ConstIterator cend() const { return m_presets.cend(); }
void reset(bool delete_files);
@ -279,8 +280,9 @@ public:
static const std::string& get_suffix_modified();
// Return a preset possibly with modifications.
Preset& default_preset() { return m_presets.front(); }
const Preset& default_preset() const { return m_presets.front(); }
Preset& default_preset(size_t idx = 0) { assert(idx < m_num_default_presets); return m_presets[idx]; }
const Preset& default_preset(size_t idx = 0) const { assert(idx < m_num_default_presets); return m_presets[idx]; }
virtual const Preset& default_preset_for(const DynamicPrintConfig & /* config */) const { return this->default_preset(); }
// Return a preset by an index. If the preset is active, a temporary copy is returned.
Preset& preset(size_t idx) { return (int(idx) == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
const Preset& preset(size_t idx) const { return const_cast<PresetCollection*>(this)->preset(idx); }
@ -440,6 +442,16 @@ private:
friend class PresetBundle;
};
// Printer supports the FFF and SLA technologies, with different set of configuration values,
// therefore this PresetCollection needs to handle two defaults.
class PrinterPresetCollection : public PresetCollection
{
public:
PrinterPresetCollection(Preset::Type type, const std::vector<std::string> &keys, const Slic3r::StaticPrintConfig &defaults, const std::string &default_name = "- default -") :
PresetCollection(type, keys, defaults, default_name) {}
const Preset& default_preset_for(const DynamicPrintConfig &config) const override;
};
} // namespace Slic3r
#endif /* slic3r_Preset_hpp_ */

View File

@ -79,13 +79,17 @@ PresetBundle::PresetBundle() :
this->printers.preset(1).printer_technology() = ptSLA;
for (size_t i = 0; i < 2; ++ i) {
// The following ugly switch is to avoid printers.preset(0) to return the edited instance, as the 0th default is the current one.
Preset &preset = (i == 0) ? this->printers.default_preset() : this->printers.preset(1);
Preset &preset = this->printers.default_preset(i);
preset.config.optptr("printer_settings_id", true);
preset.config.optptr("printer_vendor", true);
preset.config.optptr("printer_model", true);
preset.config.optptr("printer_variant", true);
preset.config.optptr("default_print_profile", true);
preset.config.option<ConfigOptionStrings>("default_filament_profile", true)->values = { "" };
if (i == 0) {
preset.config.optptr("default_print_profile", true);
preset.config.option<ConfigOptionStrings>("default_filament_profile", true)->values = { "" };
} else
preset.config.optptr("default_sla_material_profile", true);
// default_sla_material_profile
preset.inherits();
}
@ -310,10 +314,17 @@ void PresetBundle::load_selections(const AppConfig &config)
// If the printer profile enumerated by the config are not visible, select an alternate preset.
// Do not select alternate profiles for the print / filament profiles as those presets
// will be selected by the following call of this->update_compatible_with_printer(true).
prints.select_preset_by_name_strict(initial_print_profile_name);
filaments.select_preset_by_name_strict(initial_filament_profile_name);
sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name);
printers.select_preset_by_name(initial_printer_profile_name, true);
PrinterTechnology printer_technology = printers.get_selected_preset().printer_technology();
if (printer_technology == ptFFF) {
prints.select_preset_by_name_strict(initial_print_profile_name);
filaments.select_preset_by_name_strict(initial_filament_profile_name);
sla_materials.select_preset_by_name(initial_sla_material_profile_name, true);
} else {
prints.select_preset_by_name(initial_print_profile_name, true);
filaments.select_preset_by_name(initial_filament_profile_name, true);
sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name);
}
if (printers.get_selected_preset().printer_technology() == ptFFF) {
// Load the names of the other filament profiles selected for a multi-material printer.
@ -342,8 +353,8 @@ void PresetBundle::load_selections(const AppConfig &config)
// Export selections (current print, current filaments, current printer) into config.ini
void PresetBundle::export_selections(AppConfig &config)
{
assert(filament_presets.size() >= 1);
assert(filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front());
assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() >= 1);
assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front());
config.clear_section("presets");
config.set("presets", "print", prints.get_selected_preset_name());
config.set("presets", "filament", filament_presets.front());
@ -975,7 +986,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
} else if (boost::starts_with(section.first, "sla_material:")) {
presets = &this->sla_materials;
loaded = &loaded_sla_materials;
preset_name = section.first.substr(9);
preset_name = section.first.substr(13);
} else if (boost::starts_with(section.first, "printer:")) {
presets = &this->printers;
loaded = &loaded_printers;
@ -1025,25 +1036,25 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
continue;
if (presets != nullptr) {
// Load the print, filament or printer preset.
const DynamicPrintConfig &default_config = presets->default_preset().config;
DynamicPrintConfig config(default_config);
for (auto &kvp : section.second)
config.set_deserialize(kvp.first, kvp.second.data());
const DynamicPrintConfig *default_config = nullptr;
DynamicPrintConfig config;
if (presets == &this->printers) {
// Select the default config based on the printer_technology field extracted from kvp.
DynamicPrintConfig config_src;
for (auto &kvp : section.second)
config_src.set_deserialize(kvp.first, kvp.second.data());
default_config = &presets->default_preset_for(config_src).config;
config = *default_config;
config.apply(config_src);
} else {
default_config = &presets->default_preset().config;
config = *default_config;
for (auto &kvp : section.second)
config.set_deserialize(kvp.first, kvp.second.data());
}
Preset::normalize(config);
// Report configuration fields, which are misplaced into a wrong group.
std::string incorrect_keys;
size_t n_incorrect_keys = 0;
for (const std::string &key : config.keys())
if (! default_config.has(key)) {
if (incorrect_keys.empty())
incorrect_keys = key;
else {
incorrect_keys += ", ";
incorrect_keys += key;
}
config.erase(key);
++ n_incorrect_keys;
}
std::string incorrect_keys = Preset::remove_invalid_keys(config, *default_config);
if (! incorrect_keys.empty())
BOOST_LOG_TRIVIAL(error) << "Error in a Vendor Config Bundle \"" << path << "\": The printer preset \"" <<
section.first << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed";
@ -1204,16 +1215,17 @@ void PresetBundle::update_compatible_with_printer(bool select_other_if_incompati
}
}
}
break;
}
case ptSLA:
{
const std::string &prefered_print_profile = printer_preset.config.opt_string("default_print_profile");
const std::vector<std::string> &prefered_filament_profiles = printer_preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
prefered_print_profile.empty() ?
const std::string &prefered_sla_material_profile = printer_preset.config.opt_string("default_sla_material_profile");
prefered_sla_material_profile.empty() ?
this->sla_materials.update_compatible_with_printer(printer_preset, select_other_if_incompatible) :
this->sla_materials.update_compatible_with_printer(printer_preset, select_other_if_incompatible,
[&prefered_print_profile](const std::string& profile_name) { return profile_name == prefered_print_profile; });
}
[&prefered_sla_material_profile](const std::string& profile_name){ return profile_name == prefered_sla_material_profile; });
break;
}
}
}

View File

@ -41,7 +41,7 @@ public:
PresetCollection prints;
PresetCollection filaments;
PresetCollection sla_materials;
PresetCollection printers;
PrinterPresetCollection printers;
// Filament preset names for a multi-extruder or multi-material print.
// extruders.size() should be the same as printers.get_edited_preset().config.nozzle_diameter.size()
std::vector<std::string> filament_presets;

View File

@ -788,21 +788,36 @@ void Tab::update_preset_description_line()
description_line += "\t" + _(L("vendor")) + ": " + (name()=="printer" ? "\n\t\t" : "") + parent->vendor->name +
", ver: " + parent->vendor->config_version.to_string();
if (name() == "printer") {
const std::string &printer_model = preset.config.opt_string("printer_model");
const std::string &default_print_profile = preset.config.opt_string("default_print_profile");
const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
if (!printer_model.empty())
const std::string &printer_model = preset.config.opt_string("printer_model");
if (! printer_model.empty())
description_line += "\n\n\t" + _(L("printer model")) + ": \n\t\t" + printer_model;
if (!default_print_profile.empty())
description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile;
if (!default_filament_profiles.empty())
switch (preset.printer_technology()) {
case ptFFF:
{
description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t";
for (auto& profile : default_filament_profiles) {
if (&profile != &*default_filament_profiles.begin())
description_line += ", ";
description_line += profile;
//FIXME add prefered_sla_material_profile for SLA
const std::string &default_print_profile = preset.config.opt_string("default_print_profile");
const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
if (!default_print_profile.empty())
description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile;
if (!default_filament_profiles.empty())
{
description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t";
for (auto& profile : default_filament_profiles) {
if (&profile != &*default_filament_profiles.begin())
description_line += ", ";
description_line += profile;
}
}
break;
}
case ptSLA:
{
//FIXME add prefered_sla_material_profile for SLA
const std::string &default_sla_material_profile = preset.config.opt_string("default_sla_material_profile");
if (!default_sla_material_profile.empty())
description_line += "\n\n\t" + _(L("default SLA material profile")) + ": \n\t\t" + default_sla_material_profile;
break;
}
}
}
}
@ -2051,7 +2066,8 @@ void TabPrinter::on_preset_loaded()
void TabPrinter::update_pages()
{
// update m_pages ONLY if printer technology is changed
if (m_presets->get_edited_preset().printer_technology() == m_printer_technology)
const PrinterTechnology new_printer_technology = m_presets->get_edited_preset().printer_technology();
if (new_printer_technology == m_printer_technology)
return;
// hide all old pages
@ -2063,7 +2079,8 @@ void TabPrinter::update_pages()
// build Tab according to the technology, if it's not exist jet OR
// set m_pages_(technology after changing) to m_pages
if (m_presets->get_edited_preset().printer_technology() == ptFFF)
// m_printer_technology will be set by Tab::load_current_preset()
if (new_printer_technology == ptFFF)
m_pages_fff.empty() ? build_fff() : m_pages.swap(m_pages_fff);
else
m_pages_sla.empty() ? build_sla() : m_pages.swap(m_pages_sla);
@ -2224,25 +2241,25 @@ void Tab::load_current_preset()
int page_id = wxGetApp().tab_panel()->FindPage(tab.panel);
wxGetApp().tab_panel()->GetPage(page_id)->Show(false);
wxGetApp().tab_panel()->RemovePage(page_id);
}
else
} else
wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab.panel, tab.panel->title());
}
static_cast<TabPrinter*>(this)->m_printer_technology = printer_technology;
}
}
on_presets_changed();
if (name() == "print")
update_frequently_changed_parameters();
if (m_name == "printer") {
static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<TabPrinter*>(this)->m_extruders_count;
const Preset* parent_preset = m_presets->get_selected_preset_parent();
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
on_presets_changed();
if (printer_technology == ptFFF) {
static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<TabPrinter*>(this)->m_extruders_count;
const Preset* parent_preset = m_presets->get_selected_preset_parent();
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
}
}
else {
on_presets_changed();
if (m_name == "print")
update_frequently_changed_parameters();
}
m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue;
init_options_list();
update_changed_ui();
@ -2550,7 +2567,7 @@ void Tab::delete_preset()
// Delete the file and select some other reasonable preset.
// The 'external' presets will only be removed from the preset list, their files will not be deleted.
try{ m_presets->delete_current_preset(); }
catch (const std::exception &e)
catch (const std::exception & /* e */)
{
return;
}

View File

@ -213,6 +213,7 @@ public:
wxString title() const { return m_title; }
std::string name() const { return m_name; }
Preset::Type type() const { return m_type; }
virtual bool supports_printer_technology(const PrinterTechnology tech) = 0;
void create_preset_tab();
void load_current_preset();
@ -291,6 +292,7 @@ public:
void reload_config() override;
void update() override;
void OnActivate() override;
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptFFF; }
};
//Slic3r::GUI::Tab::Filament;
@ -308,6 +310,7 @@ public:
void reload_config() override;
void update() override;
void OnActivate() override;
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptFFF; }
};
//Slic3r::GUI::Tab::Printer;
@ -321,9 +324,9 @@ class TabPrinter : public Tab
std::vector<PageShp> m_pages_fff;
std::vector<PageShp> m_pages_sla;
public:
wxButton* m_serial_test_btn;
wxButton* m_print_host_test_btn;
wxButton* m_printhost_browse_btn;
wxButton* m_serial_test_btn = nullptr;
wxButton* m_print_host_test_btn = nullptr;
wxButton* m_printhost_browse_btn = nullptr;
size_t m_extruders_count;
size_t m_extruders_count_old = 0;
@ -349,6 +352,7 @@ public:
void build_extruder_pages();
void on_preset_loaded() override;
void init_options_list() override;
bool supports_printer_technology(const PrinterTechnology /* tech */) override { return true; }
};
class TabSLAMaterial : public Tab
@ -362,6 +366,7 @@ public:
void build() override;
void update() override;
void init_options_list() override;
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptSLA; }
};
class SavePresetWindow :public wxDialog