Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
435163fb73
@ -44,11 +44,12 @@ endif ()
|
||||
|
||||
# CMAKE_PREFIX_PATH is used to point CMake to the remaining dependencies (Boost, TBB, ...)
|
||||
# We pick it from environment if it is not defined in another way
|
||||
if(NOT DEFINED CMAKE_PREFIX_PATH)
|
||||
if(DEFINED ENV{CMAKE_PREFIX_PATH})
|
||||
if (NOT DEFINED CMAKE_PREFIX_PATH)
|
||||
if (DEFINED ENV{CMAKE_PREFIX_PATH})
|
||||
set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
|
||||
|
||||
# Add our own cmake module path.
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
|
||||
@ -272,7 +273,7 @@ add_custom_target(pot
|
||||
|
||||
# libslic3r, Slic3r GUI and the slic3r executable.
|
||||
add_subdirectory(src)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT slic3r)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT slic3r_app_console)
|
||||
|
||||
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
|
||||
# Also runs the unit / integration tests.
|
||||
|
19
deps/CMakeLists.txt
vendored
19
deps/CMakeLists.txt
vendored
@ -15,21 +15,26 @@
|
||||
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
||||
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
||||
#
|
||||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-conffig` utility,
|
||||
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||
#
|
||||
|
||||
project(Slic3r-deps)
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
include(ProcessorCount)
|
||||
|
||||
ProcessorCount(NPROC)
|
||||
if (NPROC EQUAL 0)
|
||||
set(NPROC 1)
|
||||
endif ()
|
||||
|
||||
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
|
||||
option(DEP_DEBUG "Build debug variants (currently only works on Windows)" ON)
|
||||
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
|
||||
|
||||
message(STATUS "Slic3r deps DESTDIR: ${DESTDIR}")
|
||||
message(STATUS "Slic3r deps debug build: ${DEP_DEBUG}")
|
||||
|
||||
if (MSVC)
|
||||
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
@ -43,8 +48,16 @@ if (MSVC)
|
||||
else ()
|
||||
message(FATAL_ERROR "Unable to detect architecture")
|
||||
endif ()
|
||||
elseif (APPLE)
|
||||
set(DEPS_OSX_TARGET "10.9" CACHE STRING "OS X SDK version to build against")
|
||||
set(DEPS_OSX_SYSROOT
|
||||
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${DEPS_OSX_TARGET}.sdk"
|
||||
CACHE PATH "OS X SDK directory"
|
||||
)
|
||||
|
||||
include("deps-macos.cmake")
|
||||
else ()
|
||||
include("deps-unix-static.cmake")
|
||||
include("deps-linux.cmake")
|
||||
endif()
|
||||
|
||||
add_custom_target(deps ALL
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
|
||||
|
||||
include("deps-unix-common.cmake")
|
||||
|
||||
|
||||
ExternalProject_Add(dep_boost
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
|
||||
@ -9,74 +14,17 @@ ExternalProject_Add(dep_boost
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
BUILD_COMMAND ./b2
|
||||
-j ${NPROC}
|
||||
--reconfigure
|
||||
link=static
|
||||
variant=release
|
||||
threading=multi
|
||||
boost.locale.icu=off
|
||||
cxxflags=-fPIC cflags=-fPIC
|
||||
cflags=-fPIC
|
||||
cxxflags=-fPIC
|
||||
install
|
||||
INSTALL_COMMAND "" # b2 does that already
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_tbb
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
|
||||
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
|
||||
CMAKE_ARGS -DTBB_BUILD_SHARED=OFF
|
||||
-DTBB_BUILD_TESTS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_gtest
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
|
||||
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
|
||||
CMAKE_ARGS -DBUILD_GMOCK=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_nlopt
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
|
||||
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DNLOPT_PYTHON=OFF
|
||||
-DNLOPT_OCTAVE=OFF
|
||||
-DNLOPT_MATLAB=OFF
|
||||
-DNLOPT_GUILE=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://zlib.net/zlib-1.2.11.tar.xz"
|
||||
URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libpng
|
||||
DEPENDS dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "http://prdownloads.sourceforge.net/libpng/libpng-1.6.35.tar.xz?download"
|
||||
URL_HASH SHA256=23912ec8c9584917ed9b09c5023465d71709dce089be503c7867fec68a93bcd7
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DPNG_SHARED=OFF
|
||||
-DPNG_TESTS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libopenssl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz"
|
||||
@ -94,7 +42,7 @@ ExternalProject_Add(dep_libopenssl
|
||||
|
||||
ExternalProject_Add(dep_libcurl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
DEPENDS dep_libopenssl
|
||||
DEPENDS dep_libopenssl
|
||||
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
|
||||
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
|
||||
BUILD_IN_SOURCE 1
|
||||
@ -145,10 +93,11 @@ ExternalProject_Add(dep_wxwidgets
|
||||
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
|
||||
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h
|
||||
CONFIGURE_COMMAND ./configure
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
--disable-shared
|
||||
--with-gtk=2
|
||||
--with-gtk=2
|
||||
--with-opengl
|
||||
--enable-unicode
|
||||
--enable-graphics_ctx
|
||||
@ -162,6 +111,8 @@ ExternalProject_Add(dep_wxwidgets
|
||||
--disable-precomp-headers
|
||||
--enable-debug_info
|
||||
--enable-debug_gdb
|
||||
--disable-debug
|
||||
--disable-debug_flag
|
||||
BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo
|
||||
INSTALL_COMMAND make install
|
||||
)
|
103
deps/deps-macos.cmake
vendored
Normal file
103
deps/deps-macos.cmake
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
|
||||
set(DEP_CMAKE_OPTS
|
||||
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
|
||||
"-DCMAKE_OSX_SYSROOT=${DEPS_OSX_SYSROOT}"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPS_OSX_TARGET}"
|
||||
)
|
||||
|
||||
include("deps-unix-common.cmake")
|
||||
|
||||
|
||||
ExternalProject_Add(dep_boost
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
|
||||
URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./bootstrap.sh
|
||||
--with-libraries=system,filesystem,thread,log,locale,regex
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
BUILD_COMMAND ./b2
|
||||
-j ${NPROC}
|
||||
--reconfigure
|
||||
link=static
|
||||
variant=release
|
||||
threading=multi
|
||||
boost.locale.icu=off
|
||||
"cflags=cflags=-fPIC -mmacosx-version-min=${DEPS_OSX_TARGET}"
|
||||
"cxxflags=cxxflags=-fPIC -mmacosx-version-min=${DEPS_OSX_TARGET}"
|
||||
install
|
||||
INSTALL_COMMAND "" # b2 does that already
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libcurl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
|
||||
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./configure
|
||||
--enable-static
|
||||
--disable-shared
|
||||
"--with-ssl=${DESTDIR}/usr/local"
|
||||
--with-pic
|
||||
--enable-ipv6
|
||||
--enable-versioned-symbols
|
||||
--enable-threaded-resolver
|
||||
--with-darwinssl
|
||||
--without-ssl # disables OpenSSL
|
||||
--disable-ldap
|
||||
--disable-ldaps
|
||||
--disable-manual
|
||||
--disable-rtsp
|
||||
--disable-dict
|
||||
--disable-telnet
|
||||
--disable-pop3
|
||||
--disable-imap
|
||||
--disable-smb
|
||||
--disable-smtp
|
||||
--disable-gopher
|
||||
--disable-crypto-auth
|
||||
--without-gssapi
|
||||
--without-libpsl
|
||||
--without-libidn2
|
||||
--without-gnutls
|
||||
--without-polarssl
|
||||
--without-mbedtls
|
||||
--without-cyassl
|
||||
--without-nss
|
||||
--without-axtls
|
||||
--without-brotli
|
||||
--without-libmetalink
|
||||
--without-libssh
|
||||
--without-libssh2
|
||||
--without-librtmp
|
||||
--without-nghttp2
|
||||
--without-zsh-functions-dir
|
||||
BUILD_COMMAND make "-j${NPROC}"
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_wxwidgets
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
|
||||
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h
|
||||
CONFIGURE_COMMAND ./configure
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
--disable-shared
|
||||
--with-osx_cocoa
|
||||
"--with-macosx-version-min=${DEPS_OSX_TARGET}"
|
||||
"--with-macosx-sdk=${DEPS_OSX_SYSROOT}"
|
||||
--with-opengl
|
||||
--with-regex=builtin
|
||||
--with-libpng=builtin
|
||||
--with-libxpm=builtin
|
||||
--with-libjpeg=builtin
|
||||
--with-libtiff=builtin
|
||||
--with-zlib=builtin
|
||||
--with-expat=builtin
|
||||
--disable-debug
|
||||
--disable-debug_flag
|
||||
BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo
|
||||
INSTALL_COMMAND make install
|
||||
)
|
60
deps/deps-unix-common.cmake
vendored
Normal file
60
deps/deps-unix-common.cmake
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
# The unix common part expects DEP_CMAKE_OPTS to be set
|
||||
|
||||
ExternalProject_Add(dep_tbb
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
|
||||
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
|
||||
CMAKE_ARGS
|
||||
-DTBB_BUILD_SHARED=OFF
|
||||
-DTBB_BUILD_TESTS=OFF
|
||||
${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_gtest
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
|
||||
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
|
||||
CMAKE_ARGS -DBUILD_GMOCK=OFF ${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_nlopt
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
|
||||
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DNLOPT_PYTHON=OFF
|
||||
-DNLOPT_OCTAVE=OFF
|
||||
-DNLOPT_MATLAB=OFF
|
||||
-DNLOPT_GUILE=OFF
|
||||
${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://zlib.net/zlib-1.2.11.tar.xz"
|
||||
URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS ${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libpng
|
||||
DEPENDS dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "http://prdownloads.sourceforge.net/libpng/libpng-1.6.35.tar.xz?download"
|
||||
URL_HASH SHA256=23912ec8c9584917ed9b09c5023465d71709dce089be503c7867fec68a93bcd7
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DPNG_SHARED=OFF
|
||||
-DPNG_TESTS=OFF
|
||||
${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
8
deps/deps-windows.cmake
vendored
8
deps/deps-windows.cmake
vendored
@ -45,7 +45,7 @@ ExternalProject_Add(dep_tbb
|
||||
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_DEBUG_POSTFIX=d
|
||||
-DCMAKE_DEBUG_POSTFIX=_debug
|
||||
-DTBB_BUILD_SHARED=OFF
|
||||
-DTBB_BUILD_TESTS=OFF
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
@ -68,7 +68,9 @@ ExternalProject_Add(dep_gtest
|
||||
URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
|
||||
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS -DBUILD_GMOCK=OFF
|
||||
CMAKE_ARGS
|
||||
-DBUILD_GMOCK=OFF
|
||||
-Dgtest_force_shared_crt=ON
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
@ -91,6 +93,7 @@ ExternalProject_Add(dep_nlopt
|
||||
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DNLOPT_PYTHON=OFF
|
||||
-DNLOPT_OCTAVE=OFF
|
||||
-DNLOPT_MATLAB=OFF
|
||||
@ -118,6 +121,7 @@ ExternalProject_Add(dep_zlib
|
||||
URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
"-DINSTALL_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}\\fallout" # I found no better way of preventing zlib creating & installing DLLs :-/
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
|
@ -163,6 +163,13 @@ if (MSVC)
|
||||
VERBATIM
|
||||
)
|
||||
endif ()
|
||||
elseif (XCODE)
|
||||
# Because of Debug/Release/etc. configurations (similar to MSVC) the slic3r binary is located in an extra level
|
||||
add_custom_command(TARGET slic3r POST_BUILD
|
||||
COMMAND ln -sf "${SLIC3R_RESOURCES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/resources"
|
||||
COMMENT "Symlinking the resources directory into the build tree"
|
||||
VERBATIM
|
||||
)
|
||||
else ()
|
||||
add_custom_command(TARGET slic3r POST_BUILD
|
||||
COMMAND ln -sf "${SLIC3R_RESOURCES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/../resources"
|
||||
|
@ -699,6 +699,14 @@ void ModelObject::clear_volumes()
|
||||
this->invalidate_bounding_box();
|
||||
}
|
||||
|
||||
void ModelObject::reset_volumes_idxs()
|
||||
{
|
||||
for (ModelVolume *v : this->volumes)
|
||||
{
|
||||
v->set_new_unique_id();
|
||||
}
|
||||
}
|
||||
|
||||
ModelInstance* ModelObject::add_instance()
|
||||
{
|
||||
ModelInstance* i = new ModelInstance(this);
|
||||
|
@ -200,6 +200,9 @@ public:
|
||||
void clear_volumes();
|
||||
bool is_multiparts() const { return volumes.size() > 1; }
|
||||
|
||||
// set a new unique id to all volumes
|
||||
void reset_volumes_idxs();
|
||||
|
||||
ModelInstance* add_instance();
|
||||
ModelInstance* add_instance(const ModelInstance &instance);
|
||||
ModelInstance* add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation);
|
||||
|
@ -2349,14 +2349,14 @@ void PrintConfigDef::init_sla_params()
|
||||
def->tooltip = L("Width of the display");
|
||||
def->cli = "display-width=f";
|
||||
def->min = 1;
|
||||
def->default_value = new ConfigOptionFloat(150.);
|
||||
def->default_value = new ConfigOptionFloat(120.);
|
||||
|
||||
def = this->add("display_height", coFloat);
|
||||
def->label = L("Display height");
|
||||
def->tooltip = L("Height of the display");
|
||||
def->cli = "display-height=f";
|
||||
def->min = 1;
|
||||
def->default_value = new ConfigOptionFloat(100.);
|
||||
def->default_value = new ConfigOptionFloat(68.);
|
||||
|
||||
def = this->add("display_pixels_x", coInt);
|
||||
def->full_label = L("Number of pixels in");
|
||||
@ -2364,14 +2364,14 @@ void PrintConfigDef::init_sla_params()
|
||||
def->tooltip = L("Number of pixels in X");
|
||||
def->cli = "display-pixels-x=i";
|
||||
def->min = 100;
|
||||
def->default_value = new ConfigOptionInt(2000);
|
||||
def->default_value = new ConfigOptionInt(2560);
|
||||
|
||||
def = this->add("display_pixels_y", coInt);
|
||||
def->label = ("Y");
|
||||
def->tooltip = L("Number of pixels in Y");
|
||||
def->cli = "display-pixels-y=i";
|
||||
def->min = 100;
|
||||
def->default_value = new ConfigOptionInt(1000);
|
||||
def->default_value = new ConfigOptionInt(1440);
|
||||
|
||||
def = this->add("printer_correction", coFloats);
|
||||
def->full_label = L("Printer scaling correction");
|
||||
|
@ -948,8 +948,10 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
||||
for (const t_config_option_key &opt_key : opt_keys) {
|
||||
if (opt_key == "layer_height") {
|
||||
steps.emplace_back(slaposObjectSlice);
|
||||
} else if (opt_key == "supports_enable"
|
||||
|| opt_key == "support_head_front_diameter"
|
||||
} else if (opt_key == "supports_enable") {
|
||||
steps.emplace_back(slaposSupportPoints);
|
||||
} else if (
|
||||
opt_key == "support_head_front_diameter"
|
||||
|| opt_key == "support_head_penetration"
|
||||
|| opt_key == "support_head_width"
|
||||
|| opt_key == "support_pillar_diameter"
|
||||
@ -1092,21 +1094,20 @@ TriangleMesh SLAPrintObject::get_mesh(SLAPrintObjectStep step) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const TriangleMesh& SLAPrintObject::support_mesh() const
|
||||
{
|
||||
if(m_supportdata && m_supportdata->support_tree_ptr)
|
||||
return m_supportdata->support_tree_ptr->merged_mesh();
|
||||
if(m_config.supports_enable.getBool() && m_supportdata &&
|
||||
m_supportdata->support_tree_ptr) return m_supportdata->support_tree_ptr->merged_mesh();
|
||||
|
||||
return EMPTY_MESH;
|
||||
}
|
||||
|
||||
const TriangleMesh& SLAPrintObject::pad_mesh() const
|
||||
{
|
||||
if(!m_supportdata || !m_supportdata->support_tree_ptr) return EMPTY_MESH;
|
||||
if(m_config.pad_enable.getBool() && m_supportdata && m_supportdata->support_tree_ptr)
|
||||
return m_supportdata->support_tree_ptr->get_pad();
|
||||
|
||||
return m_supportdata->support_tree_ptr->get_pad();
|
||||
return EMPTY_MESH;
|
||||
}
|
||||
|
||||
const TriangleMesh &SLAPrintObject::transformed_mesh() const {
|
||||
|
@ -1838,6 +1838,59 @@ void GLCanvas3D::Selection::erase()
|
||||
|
||||
wxGetApp().obj_list()->delete_from_model_and_list(items);
|
||||
}
|
||||
else if (is_mixed())
|
||||
{
|
||||
std::set<ItemForDelete> items_set;
|
||||
std::map<int, int> volumes_in_obj;
|
||||
|
||||
for (auto i : m_list) {
|
||||
const auto gl_vol = (*m_volumes)[i];
|
||||
const auto glv_obj_idx = gl_vol->object_idx();
|
||||
const auto model_object = m_model->objects[glv_obj_idx];
|
||||
|
||||
if (model_object->instances.size() == 1) {
|
||||
if (model_object->volumes.size() == 1)
|
||||
items_set.insert(ItemForDelete(ItemType::itObject, glv_obj_idx, -1));
|
||||
else {
|
||||
items_set.insert(ItemForDelete(ItemType::itVolume, glv_obj_idx, gl_vol->volume_idx()));
|
||||
int idx = (volumes_in_obj.find(glv_obj_idx) == volumes_in_obj.end()) ? 0 : volumes_in_obj.at(glv_obj_idx);
|
||||
volumes_in_obj[glv_obj_idx] = ++idx;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto glv_ins_idx = gl_vol->instance_idx();
|
||||
|
||||
for (auto obj_ins : m_cache.content) {
|
||||
if (obj_ins.first == glv_obj_idx) {
|
||||
if (obj_ins.second.find(glv_ins_idx) != obj_ins.second.end()) {
|
||||
if (obj_ins.second.size() == model_object->instances.size())
|
||||
items_set.insert(ItemForDelete(ItemType::itVolume, glv_obj_idx, gl_vol->volume_idx()));
|
||||
else
|
||||
items_set.insert(ItemForDelete(ItemType::itInstance, glv_obj_idx, glv_ins_idx));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ItemForDelete> items;
|
||||
items.reserve(items_set.size());
|
||||
for (const ItemForDelete& i : items_set) {
|
||||
if (i.type == ItemType::itVolume ) {
|
||||
const int vol_in_obj_cnt = volumes_in_obj.find(i.obj_idx) == volumes_in_obj.end() ? 0 : volumes_in_obj.at(i.obj_idx);
|
||||
if (vol_in_obj_cnt == m_model->objects[i.obj_idx]->volumes.size()) {
|
||||
if (i.sub_obj_idx == vol_in_obj_cnt - 1)
|
||||
items.emplace_back(ItemType::itObject, i.obj_idx, 0);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
items.emplace_back(i.type, i.obj_idx, i.sub_obj_idx);
|
||||
}
|
||||
|
||||
wxGetApp().obj_list()->delete_from_model_and_list(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set<std::pair<int, int>> volumes_idxs;
|
||||
|
@ -309,6 +309,7 @@ GLGizmoRotate::GLGizmoRotate(GLCanvas3D& parent, GLGizmoRotate::Axis axis)
|
||||
: GLGizmoBase(parent)
|
||||
, m_axis(axis)
|
||||
, m_angle(0.0)
|
||||
, m_quadric(nullptr)
|
||||
, m_center(0.0, 0.0, 0.0)
|
||||
, m_radius(0.0f)
|
||||
, m_snap_coarse_in_radius(0.0f)
|
||||
@ -316,6 +317,32 @@ GLGizmoRotate::GLGizmoRotate(GLCanvas3D& parent, GLGizmoRotate::Axis axis)
|
||||
, m_snap_fine_in_radius(0.0f)
|
||||
, m_snap_fine_out_radius(0.0f)
|
||||
{
|
||||
m_quadric = ::gluNewQuadric();
|
||||
if (m_quadric != nullptr)
|
||||
::gluQuadricDrawStyle(m_quadric, GLU_FILL);
|
||||
}
|
||||
|
||||
GLGizmoRotate::GLGizmoRotate(const GLGizmoRotate& other)
|
||||
: GLGizmoBase(other.m_parent)
|
||||
, m_axis(other.m_axis)
|
||||
, m_angle(other.m_angle)
|
||||
, m_quadric(nullptr)
|
||||
, m_center(other.m_center)
|
||||
, m_radius(other.m_radius)
|
||||
, m_snap_coarse_in_radius(other.m_snap_coarse_in_radius)
|
||||
, m_snap_coarse_out_radius(other.m_snap_coarse_out_radius)
|
||||
, m_snap_fine_in_radius(other.m_snap_fine_in_radius)
|
||||
, m_snap_fine_out_radius(other.m_snap_fine_out_radius)
|
||||
{
|
||||
m_quadric = ::gluNewQuadric();
|
||||
if (m_quadric != nullptr)
|
||||
::gluQuadricDrawStyle(m_quadric, GLU_FILL);
|
||||
}
|
||||
|
||||
GLGizmoRotate::~GLGizmoRotate()
|
||||
{
|
||||
if (m_quadric != nullptr)
|
||||
::gluDeleteQuadric(m_quadric);
|
||||
}
|
||||
|
||||
void GLGizmoRotate::set_angle(double angle)
|
||||
@ -391,17 +418,19 @@ void GLGizmoRotate::on_render(const GLCanvas3D::Selection& selection) const
|
||||
std::string axis;
|
||||
switch (m_axis)
|
||||
{
|
||||
case X: { axis = "X: "; break; }
|
||||
case Y: { axis = "Y: "; break; }
|
||||
case Z: { axis = "Z: "; break; }
|
||||
case X: { axis = "X"; break; }
|
||||
case Y: { axis = "Y"; break; }
|
||||
case Z: { axis = "Z"; break; }
|
||||
}
|
||||
|
||||
#if ENABLE_WORLD_ROTATIONS
|
||||
if (m_dragging)
|
||||
if (!m_dragging && (m_hover_id == 0))
|
||||
set_tooltip(axis);
|
||||
else if (m_dragging)
|
||||
#else
|
||||
if ((single_selection && (m_hover_id == 0)) || m_dragging)
|
||||
#endif // ENABLE_WORLD_ROTATIONS
|
||||
set_tooltip(axis + format((float)Geometry::rad2deg(m_angle), 4) + "\u00B0");
|
||||
set_tooltip(axis + ": " + format((float)Geometry::rad2deg(m_angle), 4) + "\u00B0");
|
||||
else
|
||||
{
|
||||
m_center = box.center();
|
||||
@ -565,7 +594,10 @@ void GLGizmoRotate::render_grabber(const BoundingBoxf3& box) const
|
||||
|
||||
void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool picking) const
|
||||
{
|
||||
float size = m_dragging ? m_grabbers[0].get_dragging_half_size((float)box.max_size()) : m_grabbers[0].get_half_size((float)box.max_size());
|
||||
if (m_quadric == nullptr)
|
||||
return;
|
||||
|
||||
double size = m_dragging ? (double)m_grabbers[0].get_dragging_half_size((float)box.max_size()) : (double)m_grabbers[0].get_half_size((float)box.max_size());
|
||||
|
||||
float color[3];
|
||||
::memcpy((void*)color, (const void*)m_grabbers[0].color, 3 * sizeof(float));
|
||||
@ -580,28 +612,26 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick
|
||||
::glEnable(GL_LIGHTING);
|
||||
|
||||
::glColor3fv(color);
|
||||
GLUquadricObj* quadric = ::gluNewQuadric();
|
||||
::gluQuadricDrawStyle(quadric, GLU_FILL);
|
||||
::glPushMatrix();
|
||||
::glTranslated(m_grabbers[0].center(0), m_grabbers[0].center(1), m_grabbers[0].center(2));
|
||||
::glRotated(Geometry::rad2deg(m_angle), 0.0, 0.0, 1.0);
|
||||
::glRotated(90.0, 1.0, 0.0, 0.0);
|
||||
::glTranslated(0.0, 0.0, 2.0 * size);
|
||||
::gluCylinder(quadric, 0.75f * size, 0.0f, 3.0f * size, 36, 1);
|
||||
::gluQuadricOrientation(quadric, GLU_INSIDE);
|
||||
::gluDisk(quadric, 0.0f, 0.75f * size, 36, 1);
|
||||
::gluQuadricOrientation(m_quadric, GLU_OUTSIDE);
|
||||
::gluCylinder(m_quadric, 0.75 * size, 0.0, 3.0 * size, 36, 1);
|
||||
::gluQuadricOrientation(m_quadric, GLU_INSIDE);
|
||||
::gluDisk(m_quadric, 0.0, 0.75 * size, 36, 1);
|
||||
::glPopMatrix();
|
||||
::glPushMatrix();
|
||||
::glTranslated(m_grabbers[0].center(0), m_grabbers[0].center(1), m_grabbers[0].center(2));
|
||||
::glRotated(Geometry::rad2deg(m_angle), 0.0, 0.0, 1.0);
|
||||
::glRotated(-90.0, 1.0, 0.0, 0.0);
|
||||
::glTranslated(0.0, 0.0, 2.0 * size);
|
||||
::gluQuadricOrientation(quadric, GLU_OUTSIDE);
|
||||
::gluCylinder(quadric, 0.75f * size, 0.0f, 3.0f * size, 36, 1);
|
||||
::gluQuadricOrientation(quadric, GLU_INSIDE);
|
||||
::gluDisk(quadric, 0.0f, 0.75f * size, 36, 1);
|
||||
::gluQuadricOrientation(m_quadric, GLU_OUTSIDE);
|
||||
::gluCylinder(m_quadric, 0.75 * size, 0.0, 3.0 * size, 36, 1);
|
||||
::gluQuadricOrientation(m_quadric, GLU_INSIDE);
|
||||
::gluDisk(m_quadric, 0.0, 0.75 * size, 36, 1);
|
||||
::glPopMatrix();
|
||||
::gluDeleteQuadric(quadric);
|
||||
|
||||
if (!picking)
|
||||
::glDisable(GL_LIGHTING);
|
||||
@ -847,10 +877,16 @@ void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const
|
||||
|
||||
if ((single_selection && ((m_hover_id == 0) || (m_hover_id == 1))) || m_grabbers[0].dragging || m_grabbers[1].dragging)
|
||||
set_tooltip("X: " + format(scale(0), 4) + "%");
|
||||
else if (!m_grabbers[0].dragging && !m_grabbers[1].dragging && ((m_hover_id == 0) || (m_hover_id == 1)))
|
||||
set_tooltip("X");
|
||||
else if ((single_selection && ((m_hover_id == 2) || (m_hover_id == 3))) || m_grabbers[2].dragging || m_grabbers[3].dragging)
|
||||
set_tooltip("Y: " + format(scale(1), 4) + "%");
|
||||
else if (!m_grabbers[2].dragging && !m_grabbers[3].dragging && ((m_hover_id == 2) || (m_hover_id == 3)))
|
||||
set_tooltip("Y");
|
||||
else if ((single_selection && ((m_hover_id == 4) || (m_hover_id == 5))) || m_grabbers[4].dragging || m_grabbers[5].dragging)
|
||||
set_tooltip("Z: " + format(scale(2), 4) + "%");
|
||||
else if (!m_grabbers[4].dragging && !m_grabbers[5].dragging && ((m_hover_id == 4) || (m_hover_id == 5)))
|
||||
set_tooltip("Z");
|
||||
else if ((single_selection && ((m_hover_id == 6) || (m_hover_id == 7) || (m_hover_id == 8) || (m_hover_id == 9)))
|
||||
|| m_grabbers[6].dragging || m_grabbers[7].dragging || m_grabbers[8].dragging || m_grabbers[9].dragging)
|
||||
{
|
||||
@ -859,6 +895,9 @@ void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const
|
||||
tooltip += "Z: " + format(scale(2), 4) + "%";
|
||||
set_tooltip(tooltip);
|
||||
}
|
||||
else if (!m_grabbers[6].dragging && !m_grabbers[7].dragging && !m_grabbers[8].dragging && !m_grabbers[9].dragging &&
|
||||
((m_hover_id == 6) || (m_hover_id == 7) || (m_hover_id == 8) || (m_hover_id == 9)))
|
||||
set_tooltip("X/Y/Z");
|
||||
|
||||
#if ENABLE_GIZMOS_ON_TOP
|
||||
::glClear(GL_DEPTH_BUFFER_BIT);
|
||||
@ -1136,7 +1175,31 @@ GLGizmoMove3D::GLGizmoMove3D(GLCanvas3D& parent)
|
||||
, m_starting_drag_position(Vec3d::Zero())
|
||||
, m_starting_box_center(Vec3d::Zero())
|
||||
, m_starting_box_bottom_center(Vec3d::Zero())
|
||||
, m_quadric(nullptr)
|
||||
{
|
||||
m_quadric = ::gluNewQuadric();
|
||||
if (m_quadric != nullptr)
|
||||
::gluQuadricDrawStyle(m_quadric, GLU_FILL);
|
||||
}
|
||||
|
||||
GLGizmoMove3D::GLGizmoMove3D(const GLGizmoMove3D& other)
|
||||
: GLGizmoBase(other.m_parent)
|
||||
, m_displacement(other.m_displacement)
|
||||
, m_snap_step(other.m_snap_step)
|
||||
, m_starting_drag_position(other.m_starting_drag_position)
|
||||
, m_starting_box_center(other.m_starting_box_center)
|
||||
, m_starting_box_bottom_center(other.m_starting_box_bottom_center)
|
||||
, m_quadric(nullptr)
|
||||
{
|
||||
m_quadric = ::gluNewQuadric();
|
||||
if (m_quadric != nullptr)
|
||||
::gluQuadricDrawStyle(m_quadric, GLU_FILL);
|
||||
}
|
||||
|
||||
GLGizmoMove3D::~GLGizmoMove3D()
|
||||
{
|
||||
if (m_quadric != nullptr)
|
||||
::gluDeleteQuadric(m_quadric);
|
||||
}
|
||||
|
||||
bool GLGizmoMove3D::on_init()
|
||||
@ -1204,10 +1267,16 @@ void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const
|
||||
|
||||
if ((show_position && (m_hover_id == 0)) || m_grabbers[0].dragging)
|
||||
set_tooltip("X: " + format(show_position ? position(0) : m_displacement(0), 2));
|
||||
else if (!m_grabbers[0].dragging && (m_hover_id == 0))
|
||||
set_tooltip("X");
|
||||
else if ((show_position && (m_hover_id == 1)) || m_grabbers[1].dragging)
|
||||
set_tooltip("Y: " + format(show_position ? position(1) : m_displacement(1), 2));
|
||||
else if (!m_grabbers[1].dragging && (m_hover_id == 1))
|
||||
set_tooltip("Y");
|
||||
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[2].dragging && (m_hover_id == 2))
|
||||
set_tooltip("Z");
|
||||
|
||||
#if ENABLE_GIZMOS_ON_TOP
|
||||
::glClear(GL_DEPTH_BUFFER_BIT);
|
||||
@ -1248,6 +1317,9 @@ void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const
|
||||
|
||||
// draw grabbers
|
||||
render_grabbers(box);
|
||||
render_grabber_extension(X, box, false);
|
||||
render_grabber_extension(Y, box, false);
|
||||
render_grabber_extension(Z, box, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1260,6 +1332,7 @@ void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const
|
||||
|
||||
// draw grabber
|
||||
m_grabbers[m_hover_id].render(true, box.max_size());
|
||||
render_grabber_extension((Axis)m_hover_id, box, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1267,7 +1340,11 @@ void GLGizmoMove3D::on_render_for_picking(const GLCanvas3D::Selection& selection
|
||||
{
|
||||
::glDisable(GL_DEPTH_TEST);
|
||||
|
||||
render_grabbers_for_picking(selection.get_bounding_box());
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
render_grabbers_for_picking(box);
|
||||
render_grabber_extension(X, box, true);
|
||||
render_grabber_extension(Y, box, true);
|
||||
render_grabber_extension(Z, box, true);
|
||||
}
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
@ -1315,6 +1392,44 @@ double GLGizmoMove3D::calc_projection(const UpdateData& data) const
|
||||
return projection;
|
||||
}
|
||||
|
||||
void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box, bool picking) const
|
||||
{
|
||||
if (m_quadric == nullptr)
|
||||
return;
|
||||
|
||||
double size = m_dragging ? (double)m_grabbers[axis].get_dragging_half_size((float)box.max_size()) : (double)m_grabbers[axis].get_half_size((float)box.max_size());
|
||||
|
||||
float color[3];
|
||||
::memcpy((void*)color, (const void*)m_grabbers[axis].color, 3 * sizeof(float));
|
||||
if (!picking && (m_hover_id != -1))
|
||||
{
|
||||
color[0] = 1.0f - color[0];
|
||||
color[1] = 1.0f - color[1];
|
||||
color[2] = 1.0f - color[2];
|
||||
}
|
||||
|
||||
if (!picking)
|
||||
::glEnable(GL_LIGHTING);
|
||||
|
||||
::glColor3fv(color);
|
||||
::glPushMatrix();
|
||||
::glTranslated(m_grabbers[axis].center(0), m_grabbers[axis].center(1), m_grabbers[axis].center(2));
|
||||
if (axis == X)
|
||||
::glRotated(90.0, 0.0, 1.0, 0.0);
|
||||
else if (axis == Y)
|
||||
::glRotated(-90.0, 1.0, 0.0, 0.0);
|
||||
|
||||
::glTranslated(0.0, 0.0, 2.0 * size);
|
||||
::gluQuadricOrientation(m_quadric, GLU_OUTSIDE);
|
||||
::gluCylinder(m_quadric, 0.75 * size, 0.0, 3.0 * size, 36, 1);
|
||||
::gluQuadricOrientation(m_quadric, GLU_INSIDE);
|
||||
::gluDisk(m_quadric, 0.0, 0.75 * size, 36, 1);
|
||||
::glPopMatrix();
|
||||
|
||||
if (!picking)
|
||||
::glDisable(GL_LIGHTING);
|
||||
}
|
||||
|
||||
GLGizmoFlatten::GLGizmoFlatten(GLCanvas3D& parent)
|
||||
: GLGizmoBase(parent)
|
||||
, m_normal(Vec3d::Zero())
|
||||
@ -1349,9 +1464,7 @@ std::string GLGizmoFlatten::on_get_name() const
|
||||
|
||||
bool GLGizmoFlatten::on_is_activable(const GLCanvas3D::Selection& selection) const
|
||||
{
|
||||
return (selection.is_from_single_object()
|
||||
&& (selection.is_single_full_instance() || selection.is_multiple_full_instance() || selection.is_single_full_object())
|
||||
&& !selection.is_wipe_tower() && !selection.is_modifier());
|
||||
return selection.is_single_full_instance();
|
||||
}
|
||||
|
||||
void GLGizmoFlatten::on_start_dragging(const GLCanvas3D::Selection& selection)
|
||||
@ -1365,44 +1478,33 @@ void GLGizmoFlatten::on_start_dragging(const GLCanvas3D::Selection& selection)
|
||||
|
||||
void GLGizmoFlatten::on_render(const GLCanvas3D::Selection& selection) const
|
||||
{
|
||||
// The planes are rendered incorrectly when the object is being moved. We better won't render anything in that case.
|
||||
// This indeed has a better solution (to be implemented when there is more time)
|
||||
Vec3d dragged_offset(Vec3d::Zero());
|
||||
if (m_starting_center == Vec3d::Zero())
|
||||
m_starting_center = selection.get_bounding_box().center();
|
||||
dragged_offset = selection.get_bounding_box().center() - m_starting_center;
|
||||
if (dragged_offset.norm() > 0.001)
|
||||
return;
|
||||
|
||||
|
||||
#if ENABLE_GIZMOS_ON_TOP
|
||||
::glClear(GL_DEPTH_BUFFER_BIT);
|
||||
#endif // ENABLE_GIZMOS_ON_TOP
|
||||
|
||||
::glEnable(GL_DEPTH_TEST);
|
||||
::glEnable(GL_BLEND);
|
||||
|
||||
if (selection.is_from_single_object()) {
|
||||
if (m_model_object) {
|
||||
//for (const int instance_idx : instances_list) {
|
||||
for (const ModelInstance* inst : m_model_object->instances) {
|
||||
Transform3d m = inst->get_matrix();
|
||||
for (int i=0; i<(int)m_planes.size(); ++i) {
|
||||
if (i == m_hover_id)
|
||||
::glColor4f(0.9f, 0.9f, 0.9f, 0.75f);
|
||||
else
|
||||
::glColor4f(0.9f, 0.9f, 0.9f, 0.5f);
|
||||
if (selection.is_single_full_instance())
|
||||
{
|
||||
const Transform3d& m = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix();
|
||||
::glPushMatrix();
|
||||
::glMultMatrixd(m.data());
|
||||
for (int i = 0; i < (int)m_planes.size(); ++i)
|
||||
{
|
||||
if (i == m_hover_id)
|
||||
::glColor4f(0.9f, 0.9f, 0.9f, 0.75f);
|
||||
else
|
||||
::glColor4f(0.9f, 0.9f, 0.9f, 0.5f);
|
||||
|
||||
m.pretranslate(dragged_offset);
|
||||
::glPushMatrix();
|
||||
::glMultMatrixd(m.data());
|
||||
::glBegin(GL_POLYGON);
|
||||
for (const Vec3d& vertex : m_planes[i].vertices)
|
||||
::glVertex3dv(vertex.data());
|
||||
::glEnd();
|
||||
::glPopMatrix();
|
||||
}
|
||||
::glBegin(GL_POLYGON);
|
||||
for (const Vec3d& vertex : m_planes[i].vertices)
|
||||
{
|
||||
::glVertex3dv(vertex.data());
|
||||
}
|
||||
::glEnd();
|
||||
}
|
||||
::glPopMatrix();
|
||||
}
|
||||
|
||||
::glEnable(GL_CULL_FACE);
|
||||
@ -1414,20 +1516,22 @@ void GLGizmoFlatten::on_render_for_picking(const GLCanvas3D::Selection& selectio
|
||||
::glDisable(GL_DEPTH_TEST);
|
||||
::glDisable(GL_BLEND);
|
||||
|
||||
if (selection.is_from_single_object()) {
|
||||
if (m_model_object)
|
||||
for (const ModelInstance* inst : m_model_object->instances) {
|
||||
for (int i=0; i<(int)m_planes.size(); ++i) {
|
||||
::glColor3f(1.0f, 1.0f, picking_color_component(i));
|
||||
::glPushMatrix();
|
||||
::glMultMatrixd(inst->get_matrix().data());
|
||||
::glBegin(GL_POLYGON);
|
||||
for (const Vec3d& vertex : m_planes[i].vertices)
|
||||
::glVertex3dv(vertex.data());
|
||||
::glEnd();
|
||||
::glPopMatrix();
|
||||
}
|
||||
if (selection.is_single_full_instance())
|
||||
{
|
||||
const Transform3d& m = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix();
|
||||
::glPushMatrix();
|
||||
::glMultMatrixd(m.data());
|
||||
for (int i = 0; i < (int)m_planes.size(); ++i)
|
||||
{
|
||||
::glColor3f(1.0f, 1.0f, picking_color_component(i));
|
||||
::glBegin(GL_POLYGON);
|
||||
for (const Vec3d& vertex : m_planes[i].vertices)
|
||||
{
|
||||
::glVertex3dv(vertex.data());
|
||||
}
|
||||
::glEnd();
|
||||
}
|
||||
::glPopMatrix();
|
||||
}
|
||||
|
||||
::glEnable(GL_CULL_FACE);
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
|
||||
class wxWindow;
|
||||
class GLUquadric;
|
||||
typedef class GLUquadric GLUquadricObj;
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
@ -199,6 +201,8 @@ private:
|
||||
Axis m_axis;
|
||||
double m_angle;
|
||||
|
||||
GLUquadricObj* m_quadric;
|
||||
|
||||
mutable Vec3d m_center;
|
||||
mutable float m_radius;
|
||||
|
||||
@ -209,6 +213,8 @@ private:
|
||||
|
||||
public:
|
||||
GLGizmoRotate(GLCanvas3D& parent, Axis axis);
|
||||
GLGizmoRotate(const GLGizmoRotate& other);
|
||||
virtual ~GLGizmoRotate();
|
||||
|
||||
double get_angle() const { return m_angle; }
|
||||
void set_angle(double angle);
|
||||
@ -355,8 +361,12 @@ class GLGizmoMove3D : public GLGizmoBase
|
||||
Vec3d m_starting_box_center;
|
||||
Vec3d m_starting_box_bottom_center;
|
||||
|
||||
GLUquadricObj* m_quadric;
|
||||
|
||||
public:
|
||||
explicit GLGizmoMove3D(GLCanvas3D& parent);
|
||||
GLGizmoMove3D(const GLGizmoMove3D& other);
|
||||
virtual ~GLGizmoMove3D();
|
||||
|
||||
double get_snap_step(double step) const { return m_snap_step; }
|
||||
void set_snap_step(double step) { m_snap_step = step; }
|
||||
@ -378,6 +388,7 @@ protected:
|
||||
|
||||
private:
|
||||
double calc_projection(const UpdateData& data) const;
|
||||
void render_grabber_extension(Axis axis, const BoundingBoxf3& box, bool picking) const;
|
||||
};
|
||||
|
||||
class GLGizmoFlatten : public GLGizmoBase
|
||||
|
@ -949,6 +949,7 @@ bool ObjectList::del_subobject_from_object(const int obj_idx, const int idx, con
|
||||
return false;
|
||||
}
|
||||
(*m_objects)[obj_idx]->delete_instance(idx);
|
||||
(*m_objects)[obj_idx]->reset_volumes_idxs();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
@ -34,6 +34,18 @@ struct ItemForDelete
|
||||
ItemForDelete(ItemType type, int obj_idx, int sub_obj_idx)
|
||||
: type(type), obj_idx(obj_idx), sub_obj_idx(sub_obj_idx)
|
||||
{}
|
||||
|
||||
bool operator==(const ItemForDelete& r) const
|
||||
{
|
||||
return (type == r.type && obj_idx == r.obj_idx && sub_obj_idx == r.sub_obj_idx);
|
||||
}
|
||||
|
||||
bool operator<(const ItemForDelete& r) const
|
||||
{
|
||||
if (obj_idx != r.obj_idx)
|
||||
return (obj_idx < r.obj_idx);
|
||||
return (sub_obj_idx < r.sub_obj_idx);
|
||||
}
|
||||
};
|
||||
|
||||
class ObjectList : public wxDataViewCtrl
|
||||
|
@ -1063,6 +1063,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
||||
{
|
||||
arranging.store(false);
|
||||
rotoptimizing.store(false);
|
||||
background_process.set_fff_print(&fff_print);
|
||||
background_process.set_sla_print(&sla_print);
|
||||
background_process.set_gcode_preview_data(&gcode_preview_data);
|
||||
|
Loading…
Reference in New Issue
Block a user