diff --git a/application/F3DOptionsParser.cxx b/application/F3DOptionsParser.cxx index 434c77936b..0bff935459 100644 --- a/application/F3DOptionsParser.cxx +++ b/application/F3DOptionsParser.cxx @@ -316,22 +316,12 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o // cxxopts sense. HasDefault LocalHasDefaultNo = allOptionsInitialized ? HasDefault::YES : HasDefault::NO; -#ifndef F3D_NO_DEPRECATED - // Deprecated options that needs further processing - std::string deprecatedHDRI; - std::vector deprecatedInputs; - bool deprecatedQuiet = false; -#endif - try { cxxopts::Options cxxOptions(this->ExecutableName, F3D::AppTitle); cxxOptions.custom_help("[OPTIONS...] file1 file2 ..."); // clang-format off auto grp0 = cxxOptions.add_options("Applicative"); -#ifndef F3D_NO_DEPRECATED - this->DeclareOption(grp0, "input", "", "Input files (deprecated)", deprecatedInputs, LocalHasDefaultNo, MayHaveConfig::YES , ""); -#endif this->DeclareOption(grp0, "output", "", "Render to file", appOptions.Output, LocalHasDefaultNo, MayHaveConfig::YES, ""); this->DeclareOption(grp0, "no-background", "", "No background when render to file", appOptions.NoBackground, HasDefault::YES, MayHaveConfig::YES); this->DeclareOption(grp0, "help", "h", "Print help"); @@ -348,9 +338,6 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o auto grp1 = cxxOptions.add_options("General"); this->DeclareOption(grp1, "verbose", "", "Set verbose level, providing more information about the loaded data in the console output", appOptions.VerboseLevel, HasDefault::YES, MayHaveConfig::YES, "{debug, info, warning, error, quiet}", HasImplicitValue::YES, "debug"); -#ifndef F3D_NO_DEPRECATED - this->DeclareOption(grp1, "quiet", "", "Enable quiet mode, which supersede any verbose options and prevent any console output to be generated at all (deprecated, using `--verbose=quiet` instead)", deprecatedQuiet, HasDefault::YES, MayHaveConfig::YES ); -#endif this->DeclareOption(grp1, "progress", "", "Show loading progress bar", options.getAsBoolRef("ui.loader-progress"), HasDefault::YES, MayHaveConfig::YES); this->DeclareOption(grp1, "animation-progress", "", "Show animation progress bar", options.getAsBoolRef("ui.animation-progress"), HasDefault::YES, MayHaveConfig::YES); this->DeclareOption(grp1, "geometry-only", "", "Do not read materials, cameras and lights from file", appOptions.GeometryOnly, HasDefault::YES, MayHaveConfig::YES); @@ -383,9 +370,6 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o this->DeclareOption(grp2, "opacity", "", "Opacity", options.getAsDoubleRef("model.color.opacity"), HasDefault::YES, MayHaveConfig::YES, ""); this->DeclareOption(grp2, "roughness", "", "Roughness coefficient (0.0-1.0)", options.getAsDoubleRef("model.material.roughness"), HasDefault::YES, MayHaveConfig::YES, ""); this->DeclareOption(grp2, "metallic", "", "Metallic coefficient (0.0-1.0)", options.getAsDoubleRef("model.material.metallic"), HasDefault::YES, MayHaveConfig::YES, ""); -#ifndef F3D_NO_DEPRECATED - this->DeclareOption(grp2, "hdri", "", "Path to an image file that will be used as a light source and skybox (deprecated)", deprecatedHDRI, LocalHasDefaultNo, MayHaveConfig::YES, ""); -#endif this->DeclareOption(grp2, "hdri-file", "", "Path to an image file that can be used as a light source and skybox", options.getAsStringRef("render.hdri.file"), LocalHasDefaultNo, MayHaveConfig::YES, ""); this->DeclareOption(grp2, "hdri-ambient", "f", "Enable HDRI ambient lighting", options.getAsBoolRef("render.hdri.ambient"), HasDefault::YES, MayHaveConfig::YES); this->DeclareOption(grp2, "hdri-skybox", "j", "Enable HDRI skybox background", options.getAsBoolRef("render.background.skybox"), HasDefault::YES, MayHaveConfig::YES); @@ -457,35 +441,6 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o { auto result = cxxOptions.parse(this->Argc, this->Argv); -#ifndef F3D_NO_DEPRECATED - if (deprecatedQuiet) - { - f3d::log::warn("--quiet option is deprecated, please use --verbose=quiet instead."); - appOptions.VerboseLevel = "quiet"; - } - - if (!deprecatedHDRI.empty()) - { - options.set("render.hdri.file", deprecatedHDRI); - options.set("render.hdri.ambient", true); - options.set("render.background.skybox", true); - - f3d::log::warn("--hdri option is deprecated, please use --hdri-file, --hdri-ambient and " - "--hdri-skybox instead."); - } - - for (const std::string& input : deprecatedInputs) - { - /* `deprecatedInputs` may contain an empty string instead of being empty itself */ - if (!input.empty()) - { - f3d::log::warn("--input option is deprecated, please use positional arguments instead."); - break; - } - } - inputs = deprecatedInputs; -#endif - auto unmatched = result.unmatched(); bool found_unknown_option = false; for (std::string unknownOption : unmatched) diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index b677c24f92..b1aba24464 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -451,10 +451,6 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220) f3d_test(NAME TestInteractionHDRIRaytracingFullFromNone DATA suzanne.ply THRESHOLD 120 ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr -r --samples=1 LONG_TIMEOUT INTERACTION) endif() - - if (NOT F3D_EXCLUDE_DEPRECATED) - f3d_test(NAME TestHDRIDeprecated DATA suzanne.ply ARGS --hdri=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr LONG_TIMEOUT) - endif () endif() # Zoom factor was introduced in https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9958 @@ -910,11 +906,6 @@ f3d_test(NAME TestNoFileConfigFile CONFIG ${F3D_SOURCE_DIR}/testing/configs/verb # Test help display f3d_test(NAME TestHelp ARGS --help REGEXP "Usage:") f3d_test(NAME TestHelpPositional ARGS --help REGEXP "file1 file2 \.\.\.") -if (NOT F3D_EXCLUDE_DEPRECATED) - f3d_test(NAME TestDeprecatedHelpInput ARGS --help REGEXP "--input") - f3d_test(NAME TestDeprecatedInput ARGS --input a.b REGEXP "--input option is deprecated") - f3d_test(NAME TestDeprecatedQuietNonExistentFile DATA nonExistentFile.vtp ARGS --filename --verbose --quiet --no-render REGEXP_FAIL "File .*nonExistentFile.vtp does not exist" NO_BASELINE) -endif() # Test version display f3d_test(NAME TestVersion ARGS --version REGEXP "Version:") diff --git a/library/public/image.h b/library/public/image.h index 3dcd593017..6113d6d57d 100644 --- a/library/public/image.h +++ b/library/public/image.h @@ -106,9 +106,6 @@ class F3D_EXPORT image */ unsigned int getWidth() const; unsigned int getHeight() const; -#ifndef F3D_NO_DEPRECATED - F3D_DEPRECATED image& setResolution(unsigned int width, unsigned int height); -#endif ///@} ///@{ @name Channel Count @@ -118,9 +115,6 @@ class F3D_EXPORT image * \deprecated { setChannelCount is deprecated, use the appropriate constructor } */ unsigned int getChannelCount() const; -#ifndef F3D_NO_DEPRECATED - F3D_DEPRECATED image& setChannelCount(unsigned int dim); -#endif ///@} /** @@ -143,10 +137,6 @@ class F3D_EXPORT image */ image& setContent(void* buffer); void* getContent() const; -#ifndef F3D_NO_DEPRECATED - F3D_DEPRECATED image& setData(unsigned char* buffer); - F3D_DEPRECATED unsigned char* getData() const; -#endif ///@} /** diff --git a/library/src/image.cxx b/library/src/image.cxx index 19f5450f4b..381e2f70bb 100644 --- a/library/src/image.cxx +++ b/library/src/image.cxx @@ -231,32 +231,12 @@ unsigned int image::getHeight() const return dims[1]; } -#ifndef F3D_NO_DEPRECATED -//---------------------------------------------------------------------------- -image& image::setResolution(unsigned int width, unsigned int height) -{ - this->Internals->Image->SetDimensions(static_cast(width), static_cast(height), 1); - this->Internals->Image->AllocateScalars( - VTK_UNSIGNED_CHAR, static_cast(this->getChannelCount())); - return *this; -} -#endif - //---------------------------------------------------------------------------- unsigned int image::getChannelCount() const { return this->Internals->Image->GetNumberOfScalarComponents(); } -#ifndef F3D_NO_DEPRECATED -//---------------------------------------------------------------------------- -image& image::setChannelCount(unsigned int dim) -{ - this->Internals->Image->AllocateScalars(VTK_UNSIGNED_CHAR, static_cast(dim)); - return *this; -} -#endif - //---------------------------------------------------------------------------- image::ChannelType image::getChannelType() const { @@ -297,21 +277,6 @@ void* image::getContent() const return this->Internals->Image->GetScalarPointer(); } -#ifndef F3D_NO_DEPRECATED -//---------------------------------------------------------------------------- -image& image::setData(unsigned char* buffer) -{ - this->setContent(buffer); - return *this; -} - -//---------------------------------------------------------------------------- -unsigned char* image::getData() const -{ - return static_cast(this->getContent()); -} -#endif - //---------------------------------------------------------------------------- bool image::compare(const image& reference, double threshold, image& diff, double& error) const { diff --git a/library/src/options.cxx b/library/src/options.cxx index 4ca0b734be..b87a3a5dce 100644 --- a/library/src/options.cxx +++ b/library/src/options.cxx @@ -43,12 +43,6 @@ class options::internals static_assert(!std::is_array_v && !std::is_pointer_v); try { -#ifndef F3D_NO_DEPRECATED - if (this->IsDeprecated(name)) - { - log::warn("Option ", name, " is deprecated"); - } -#endif T& opt = std::get(this->Options.at(name)); opt = value; } @@ -94,12 +88,6 @@ class options::internals { try { -#ifndef F3D_NO_DEPRECATED - if (this->IsDeprecated(name)) - { - log::warn("Option ", name, " is deprecated"); - } -#endif return std::get(this->Options.at(name)); } catch (const std::bad_variant_access&) @@ -113,17 +101,6 @@ class options::internals } } -#ifndef F3D_NO_DEPRECATED - bool IsDeprecated(const std::string& name) - { - // compile time list of deprecated options - constexpr std::string_view deprecated[] = { "render.background.hdri" }; - - auto it = std::find(std::begin(deprecated), std::end(deprecated), name); - return it != std::end(deprecated); - } -#endif - std::map Options; }; @@ -166,9 +143,6 @@ options::options() this->Internals->init("render.hdri.file", std::string()); this->Internals->init("render.hdri.ambient", false); this->Internals->init("render.background.color", std::vector{ 0.2, 0.2, 0.2 }); -#ifndef F3D_NO_DEPRECATED - this->Internals->init("render.background.hdri", std::string()); -#endif this->Internals->init("render.background.skybox", false); this->Internals->init("render.background.blur", false); this->Internals->init("render.background.blur.coc", 20.0); diff --git a/library/src/window_impl.cxx b/library/src/window_impl.cxx index 7079ccc40a..3205b35721 100644 --- a/library/src/window_impl.cxx +++ b/library/src/window_impl.cxx @@ -401,15 +401,6 @@ void window_impl::UpdateDynamicOptions() std::string hdriFile = this->Internals->Options.getAsString("render.hdri.file"); bool hdriAmbient = this->Internals->Options.getAsBool("render.hdri.ambient"); bool hdriSkybox = this->Internals->Options.getAsBool("render.background.skybox"); -#ifndef F3D_NO_DEPRECATED - std::string legacyHDRI = this->Internals->Options.getAsString("render.background.hdri"); - if (!legacyHDRI.empty()) - { - hdriFile = legacyHDRI; - hdriAmbient = true; - hdriSkybox = true; - } -#endif this->Internals->Renderer->SetHDRIFile(hdriFile); this->Internals->Renderer->SetUseImageBasedLighting(hdriAmbient); this->Internals->Renderer->ShowHDRISkybox(hdriSkybox); diff --git a/library/testing/CMakeLists.txt b/library/testing/CMakeLists.txt index 7bfdca1a7d..5d3f74b3d8 100644 --- a/library/testing/CMakeLists.txt +++ b/library/testing/CMakeLists.txt @@ -23,11 +23,6 @@ list(APPEND libf3dSDKTests_list TestSDKWindowNative.cxx ) -if(NOT F3D_EXCLUDE_DEPRECATED) - list(APPEND libf3dSDKTests_list - TestSDKImageDeprecated.cxx) -endif() - # HDRI test needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9767 if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220) list(APPEND libf3dSDKTests_list diff --git a/library/testing/TestSDKDynamicHDRI.cxx b/library/testing/TestSDKDynamicHDRI.cxx index b142c02c5d..8ce055abe9 100644 --- a/library/testing/TestSDKDynamicHDRI.cxx +++ b/library/testing/TestSDKDynamicHDRI.cxx @@ -100,20 +100,5 @@ int TestSDKDynamicHDRI(int argc, char* argv[]) } #endif -#ifndef F3D_NO_DEPRECATED - // Check deprecated HDRI options - opt.set("render.hdri.ambient", false); - opt.set("render.background.skybox", false); - opt.set("render.background.hdri", std::string(argv[1]) + "data/palermo_park_1k.hdr"); - - ret = TestSDKHelpers::RenderTest(eng.getWindow(), std::string(argv[1]) + "baselines/", - std::string(argv[2]), "TestSDKDynamicHDRI", 50); - if (!ret) - { - std::cerr << "Render with deprecated HDRI option failed" << std::endl; - return EXIT_FAILURE; - } -#endif - return EXIT_SUCCESS; } diff --git a/library/testing/TestSDKImageDeprecated.cxx b/library/testing/TestSDKImageDeprecated.cxx deleted file mode 100644 index 81d1a0c588..0000000000 --- a/library/testing/TestSDKImageDeprecated.cxx +++ /dev/null @@ -1,109 +0,0 @@ -#include - -#include -#include -#include -#include - -int TestSDKImageDeprecated(int argc, char* argv[]) -{ - constexpr unsigned int width = 64; - constexpr unsigned int height = 64; - constexpr unsigned int channels = 3; - - std::vector pixels(width * height * channels); - - // fill with deterministic random values - // do not use std::uniform_int_distribution, it's not giving the same result on different - // platforms - std::mt19937 rand_generator; - std::generate(std::begin(pixels), std::end(pixels), [&]() { return rand_generator() % 256; }); - - f3d::image generated; - generated.setResolution(width, height).setChannelCount(channels).setData(pixels.data()); - generated.save(std::string(argv[2]) + "TestSDKImageDeprecated.png"); - - // test exceptions - try - { - generated.save("/dummy/folder/img.png"); - - std::cerr << "An exception has not been thrown when saving to an incorrect path" << std::endl; - return EXIT_FAILURE; - } - catch (const f3d::image::write_exception&) - { - } - - try - { - f3d::image img("/dummy/folder/img.png"); - - std::cerr << "An exception has not been thrown when reading an incorrect path" << std::endl; - return EXIT_FAILURE; - } - catch (const f3d::image::read_exception&) - { - } - - f3d::image baseline(std::string(argv[1]) + "/baselines/TestSDKImage.png"); - - if (generated.getWidth() != width || generated.getHeight() != height) - { - std::cerr << "Image has wrong dimensions" << std::endl; - return EXIT_FAILURE; - } - - if (generated.getChannelCount() != channels) - { - std::cerr << "Image has wrong number of channels" << std::endl; - return EXIT_FAILURE; - } - - if (generated.getData() == nullptr) - { - std::cerr << "Image has no data" << std::endl; - return EXIT_FAILURE; - } - - if (generated != baseline) - { - std::cerr << "Generated image is different from the baseline" << std::endl; - return EXIT_FAILURE; - } - - // test operators - f3d::image imgCopy = generated; // copy constructor - - if (imgCopy != generated) - { - std::cerr << "Copy constructor failed" << std::endl; - return EXIT_FAILURE; - } - - imgCopy = baseline; // copy assignment - - if (imgCopy != baseline) - { - std::cerr << "Copy assignment failed" << std::endl; - return EXIT_FAILURE; - } - - f3d::image imgMove = std::move(imgCopy); // move constructor - - if (imgMove != baseline) - { - std::cerr << "Move constructor failed" << std::endl; - return EXIT_FAILURE; - } - - imgCopy = std::move(imgMove); // move assignment - - if (imgCopy != baseline) - { - std::cerr << "Move assignment failed" << std::endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/library/testing/TestSDKOptions.cxx b/library/testing/TestSDKOptions.cxx index 3ac129da01..01741bcbfe 100644 --- a/library/testing/TestSDKOptions.cxx +++ b/library/testing/TestSDKOptions.cxx @@ -288,10 +288,5 @@ int TestSDKOptions(int argc, char* argv[]) std::cout << "Expected exception:" << ex.what() << std::endl; } -#ifndef F3D_NO_DEPRECATED - // Check getRef with deprecated options to increase coverage - opt.getAsStringRef("render.background.hdri"); -#endif - return EXIT_SUCCESS; } diff --git a/python/F3DPythonBindings.cxx b/python/F3DPythonBindings.cxx index 7c1e281945..e8284da6e6 100644 --- a/python/F3DPythonBindings.cxx +++ b/python/F3DPythonBindings.cxx @@ -360,130 +360,4 @@ PYBIND11_MODULE(pyf3d, module) .value("ERROR", f3d::log::VerboseLevel::ERROR) .value("QUIET", f3d::log::VerboseLevel::QUIET) .export_values(); - -// deprecated functions, will be removed in the next major release, F3D v3.0.0 -#ifndef F3D_NO_DEPRECATED -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - image // - .def("setResolution", &f3d::image::setResolution, - "DEPRECATED: use the appropriate constructor instead.") - .def("setChannelCount", &f3d::image::setResolution, - "DEPRECATED: use the appropriate constructor instead.") - .def( - "setData", [=](f3d::image& img, const py::bytes& data) { setImageBytes(img, data); }, - "DEPRECATED: use setContent instead") - .def( - "getData", [=](const f3d::image& img) { return getImageBytes(img); }, - "DEPRECATED: use getContent instead.") - .def("getWidth", &f3d::image::getWidth, "DEPRECATED") - .def("getHeight", &f3d::image::getHeight, "DEPRECATED") - .def("getChannelCount", &f3d::image::getChannelCount, "DEPRECATED") - .def("getChannelType", &f3d::image::getChannelType, "DEPRECATED") - .def("getChannelTypeSize", &f3d::image::getChannelTypeSize, "DEPRECATED") - .def("setContent", setImageBytes, "DEPRECATED") - .def("getContent", getImageBytes, "DEPRECATED"); - - options // - .def("set", py::overload_cast(&f3d::options::set), - "Set a boolean option", "DEPRECATED") - .def("set", py::overload_cast(&f3d::options::set), - "Set an integer option", "DEPRECATED") - .def("set", py::overload_cast(&f3d::options::set), - "Set a floating point option", "DEPRECATED") - .def("set", py::overload_cast(&f3d::options::set), - "Set a string option", "DEPRECATED") - .def("set", py::overload_cast&>(&f3d::options::set), - "Set an array of integers option", "DEPRECATED") - .def("set", - py::overload_cast&>(&f3d::options::set), - "Set an array of floating points option", "DEPRECATED") - .def("getAsBool", &f3d::options::getAsBool, "DEPRECATED") - .def("getAsInt", &f3d::options::getAsInt, "DEPRECATED") - .def("getAsDouble", &f3d::options::getAsDouble, "DEPRECATED") - .def("getAsString", &f3d::options::getAsString, "DEPRECATED") - .def("getAsIntVector", &f3d::options::getAsIntVector, "DEPRECATED") - .def("getAsDoubleVector", &f3d::options::getAsDoubleVector, "DEPRECATED") - .def("isSame", &f3d::options::isSame, "DEPRECATED") - .def("getNames", &f3d::options::getNames, "DEPRECATED") - .def("getClosestOption", &f3d::options::getClosestOption, "DEPRECATED"); - - utils // - .def_static("textDistance", &f3d::utils::textDistance, "DEPRECATED"); - - interactor // - .def("toggleAnimation", &f3d::interactor::toggleAnimation, "Toggle the animation", "DEPRECATED") - .def("startAnimation", &f3d::interactor::startAnimation, "Start the animation", "DEPRECATED") - .def("stopAnimation", &f3d::interactor::stopAnimation, "Stop the animation", "DEPRECATED") - .def("isPlayingAnimation", &f3d::interactor::isPlayingAnimation, - "Returns True if the animation is currently started", "DEPRECATED") - .def("enableCameraMovement", &f3d::interactor::enableCameraMovement, - "Enable the camera interaction", "DEPRECATED") - .def("disableCameraMovement", &f3d::interactor::disableCameraMovement, - "Disable the camera interaction", "DEPRECATED") - .def("playInteraction", &f3d::interactor::playInteraction, "Play an interaction file", - "DEPRECATED") - .def("recordInteraction", &f3d::interactor::recordInteraction, "Record an interaction file", - "DEPRECATED") - .def_static( - "getDefaultInteractionsInfo", &f3d::interactor::getDefaultInteractionsInfo, "DEPRECATED"); - - loader // - .def("hasGeometryReader", &f3d::loader::hasGeometryReader, "DEPRECATED") - .def("loadGeometry", py::overload_cast(&f3d::loader::loadGeometry), - "load geometry to a default scene", "DEPRECATED") - .def("hasSceneReader", &f3d::loader::hasSceneReader, "DEPRECATED") - .def("loadScene", &f3d::loader::loadScene, "Load a specific full scene file", "DEPRECATED"); - - camera // - .def("setPosition", &f3d::camera::setPosition, "DEPRECATED: use position property setter") - .def("getPosition", py::overload_cast<>(&f3d::camera::getPosition), - "DEPRECATED: use position property getter") - .def("setFocalPoint", &f3d::camera::setFocalPoint, "DEPRECATED") - .def("getFocalPoint", py::overload_cast<>(&f3d::camera::getFocalPoint), "DEPRECATED") - .def("setViewUp", &f3d::camera::setViewUp, "DEPRECATED") - .def("getViewUp", py::overload_cast<>(&f3d::camera::getViewUp), "DEPRECATED") - .def("setViewAngle", &f3d::camera::setViewAngle, "DEPRECATED") - .def("getViewAngle", py::overload_cast<>(&f3d::camera::getViewAngle), "DEPRECATED") - .def("getViewAngle", py::overload_cast(&f3d::camera::getViewAngle), - "DEPRECATED") - .def("setState", &f3d::camera::setState, "DEPRECATED") - .def("getState", py::overload_cast<>(&f3d::camera::getState), "DEPRECATED") - .def("getState", py::overload_cast(&f3d::camera::getState), "DEPRECATED") - .def("setCurrentAsDefault", &f3d::camera::setCurrentAsDefault, "DEPRECATED") - .def("resetToDefault", &f3d::camera::resetToDefault, "DEPRECATED") - .def("resetToBounds", &f3d::camera::resetToBounds, py::arg("zoomFactor") = 0.9, "DEPRECATED"); - - window // - .def("getType", &f3d::window::getType, "DEPRECATED") - .def("getCamera", &f3d::window::getCamera, py::return_value_policy::reference, "DEPRECATED") - .def("renderToImage", &f3d::window::renderToImage, "Render the window to an image", - py::arg("noBackground") = false, "DEPRECATED") - .def("setSize", &f3d::window::setSize, "Set the window size", "DEPRECATED") - .def("getWidth", &f3d::window::getWidth, "Get the window width", "DEPRECATED") - .def("getHeight", &f3d::window::getHeight, "Get the window height", "DEPRECATED") - .def("setPosition", &f3d::window::setPosition, "DEPRECATED") - .def("setIcon", &f3d::window::setIcon, - "Set the icon of the window using a memory buffer representing a PNG file", "DEPRECATED") - .def("setWindowName", &f3d::window::setWindowName, "Set the window name", "DEPRECATED") - .def("getWorldFromDisplay", &f3d::window::getWorldFromDisplay, - "Get world coordinate point from display coordinate", "DEPRECATED") - .def("getDisplayFromWorld", &f3d::window::getDisplayFromWorld, - "Get display coordinate point from world coordinate", "DEPRECATED"); - - engine // - .def("setCachePath", &f3d::engine::setCachePath, "Set the cache path directory", "DEPRECATED") - .def( - "setOptions", py::overload_cast(&f3d::engine::setOptions), "DEPRECATED") - .def("getOptions", &f3d::engine::getOptions, py::return_value_policy::reference, "DEPRECATED") - .def("getWindow", &f3d::engine::getWindow, py::return_value_policy::reference, "DEPRECATED") - .def("getLoader", &f3d::engine::getLoader, py::return_value_policy::reference, "DEPRECATED") - .def("getInteractor", &f3d::engine::getInteractor, py::return_value_policy::reference, - "DEPRECATED") - .def_static("loadPlugin", &f3d::engine::loadPlugin, "Load a plugin", "DEPRECATED") - .def_static("autoloadPlugins", &f3d::engine::autoloadPlugins, - "Automatically load internal plugins", "DEPRECATED") - .def_static("getPluginsList", &f3d::engine::getPluginsList, "DEPRECATED"); -#pragma GCC diagnostic pop -#endif } diff --git a/python/testing/CMakeLists.txt b/python/testing/CMakeLists.txt index 1afc2ef7b1..65cadbbe8f 100644 --- a/python/testing/CMakeLists.txt +++ b/python/testing/CMakeLists.txt @@ -11,12 +11,6 @@ if(NOT F3D_MACOS_BUNDLE) ) endif() -# A deprecated test use image comparison -if(NOT F3D_EXCLUDE_DEPRECATED) - list(APPEND pyf3dTests_list - test_deprecated.py) -endif() - list(APPEND pyf3dTests_list test_image_compare.py test_loader.py diff --git a/python/testing/test_deprecated.py b/python/testing/test_deprecated.py deleted file mode 100644 index 4b75a05bc2..0000000000 --- a/python/testing/test_deprecated.py +++ /dev/null @@ -1,215 +0,0 @@ -from pathlib import Path -import os -import pytest -import tempfile - -import f3d - - -def test_legacy_Camera(): - engine = f3d.engine(f3d.window.NATIVE_OFFSCREEN) - camera = engine.getWindow().getCamera() - - # Behavior is tested in the SDK test, test only the bindings - - pos = 1, 2, 3 - foc = 1, 22, 3 - up = 0, 0, 1 - angle = 32 - - camera.setPosition(pos) - camera.setFocalPoint(foc) - camera.setViewUp(up) - camera.setViewAngle(angle) - assert camera.getPosition() == pos - assert camera.getFocalPoint() == foc - assert camera.getViewUp() == up - assert camera.getViewAngle() == angle - - state = camera.getState() - assert state.pos == pos - assert state.foc == foc - assert state.up == up - assert state.angle == angle - - new_default_state = f3d.camera_state_t() - assert new_default_state.pos == (0, 0, 1) - assert new_default_state.foc == (0, 0, 0) - assert new_default_state.up == (0, 1, 0) - assert new_default_state.angle == 30 - - camera.setState(new_default_state) - assert camera.getPosition() == new_default_state.pos - assert camera.getFocalPoint() == new_default_state.foc - assert camera.getViewUp() == new_default_state.up - assert camera.getViewAngle() == new_default_state.angle - - new_state = f3d.camera_state_t(pos, foc, up, angle) - assert new_state.pos == pos - assert new_state.foc == foc - assert new_state.up == up - assert new_state.angle == angle - - camera.setState(new_state) - assert camera.getPosition() == new_state.pos - assert camera.getFocalPoint() == new_state.foc - assert camera.getViewUp() == new_state.up - assert camera.getViewAngle() == new_state.angle - - camera.dolly(10) - angle = 30 - camera.roll(angle) - camera.azimuth(angle) - camera.yaw(angle) - camera.elevation(angle) - camera.pitch(angle) - - state = camera.getState() - camera.getState(state) - camera.setState(state) - - camera.setCurrentAsDefault() - camera.resetToBounds() - camera.resetToDefault() - - -def test_legacy_CompareWithFile(): - testing_dir = Path(__file__).parent.parent.parent / "testing" - dataset = f"{testing_dir}/data/cow.vtp" - reference = f"{testing_dir}/baselines/TestPythonCompareWithFile.png" - output = tempfile.gettempdir() + "/TestPythonCompareWithFile.png" - outputDiff = tempfile.gettempdir() + "/TestPythonCompareWithFile.diff.png" - - f3d.engine.autoloadPlugins() - - engine = f3d.engine(f3d.window.NATIVE_OFFSCREEN) - engine.getWindow().setSize(300, 300) - - # verify the size is properly set - assert engine.getWindow().getWidth() == 300 - assert engine.getWindow().getHeight() == 300 - - engine.getLoader().loadGeometry(dataset, True) - - img = engine.getWindow().renderToImage() - img.save(output) - - diff = f3d.image() - error = 0.0 - - ret = img.compare(f3d.image(reference), 100, diff, error) - - if not ret: - print("img compare failing with diff=" + error) - diff.save(outputDiff) - - assert ret is True - - -def test_legacy_ImageData(): - engine = f3d.engine(f3d.window.NATIVE_OFFSCREEN) - window = engine.getWindow() - window.setSize(300, 200) - - """with background -> RGB image""" - - img = window.renderToImage() - width = img.getWidth() - height = img.getHeight() - depth = img.getChannelCount() - data = img.getContent() - - assert width == window.getWidth() - assert height == window.getHeight() - assert depth == 3 - assert isinstance(data, (bytes, bytearray)) - assert len(data) == depth * width * height - - """without background -> RGBA image""" - - img = window.renderToImage(True) - width = img.getWidth() - height = img.getHeight() - depth = img.getChannelCount() - data = img.getContent() - - assert width == window.getWidth() - assert height == window.getHeight() - assert depth == 4 - assert isinstance(data, (bytes, bytearray)) - assert len(data) == depth * width * height - - """set data back""" - - img.setData(data) - assert img.getContent() == data - - """check channel type and save image""" - - assert img.getChannelType() == f3d.image.ChannelType.BYTE - assert img.getChannelTypeSize() == 1 - - fn = tempfile.gettempdir() + "/TestPythonSaveFile.bmp" - img.save(fn, f3d.image.SaveFormat.BMP) - assert os.path.isfile(fn) - - """attempt to set partial data back""" - - try: - img.setData(data[:-1]) - assert False, "expected exception" - except ValueError: - assert True - - -def test_legacy_Options(): - engine = f3d.engine(f3d.window.NONE) - - assert engine.getOptions().getAsBool("interactor.axis") is False - assert engine.getOptions().getAsDouble("model.material.roughness") == 0.3 - assert engine.getOptions().getAsInt("render.raytracing.samples") == 5 - assert engine.getOptions().getAsDoubleVector("model.color.rgb") == [1.0, 1.0, 1.0] - assert engine.getOptions().getAsString("scene.up-direction") == "+Y" - - closest = engine.getOptions().getClosestOption("scene-direction") - assert closest[0] == "scene.up-direction" - assert closest[1] == 3 - - options = f3d.options() - options.set("interactor.axis", True) - options.set("model.material.roughness", 0.7) - options.set("render.raytracing.samples", 2) - options.set("model.color.rgb", [0.0, 1.0, 1.0]) - options.set("scene.up-direction", "-Z") - - engine.setOptions(options) - - assert engine.getOptions().getAsBool("interactor.axis") is True - assert engine.getOptions().getAsDouble("model.material.roughness") == 0.7 - assert engine.getOptions().getAsInt("render.raytracing.samples") == 2 - assert engine.getOptions().getAsDoubleVector("model.color.rgb") == [0.0, 1.0, 1.0] - assert engine.getOptions().getAsString("scene.up-direction") == "-Z" - - assert len(options.getNames()) > 0 - - options2 = engine.getOptions() - options2.set("interactor.axis", False) - assert not options2.isSame(options, "interactor.axis") - options2.copy(options, "interactor.axis") - assert options2.isSame(options, "interactor.axis") - - -def test_legacy_Plugins(): - base_dir = os.path.dirname(f3d.__file__) - plugins = f3d.engine.getPluginsList(base_dir + "/share/f3d/plugins") - plugins += f3d.engine.getPluginsList(base_dir + "/../share/f3d/plugins") - plugins += f3d.engine.getPluginsList(base_dir + "/../../share/f3d/plugins") - - assert len(plugins) > 0 - assert plugins.index("native") >= 0 - - -def test_legacy_Utils(): - distance = f3d.utils.textDistance("modle", "model") - - assert distance == 2 diff --git a/testing/baselines/TestHDRIDeprecated.png b/testing/baselines/TestHDRIDeprecated.png deleted file mode 100644 index fe63b0448e..0000000000 --- a/testing/baselines/TestHDRIDeprecated.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cdb9f8aff9568f61fc72f3531903a25ede9fd5f850ba288aed808926b7ce3934 -size 81729