| 1955 | } |
| 1956 | |
| 1957 | void Scene::renderUI(Gui::Widgets& widget) |
| 1958 | { |
| 1959 | if (mpAnimationController->hasAnimations()) |
| 1960 | { |
| 1961 | bool isEnabled = mpAnimationController->isEnabled(); |
| 1962 | if (widget.checkbox("Animate Scene", isEnabled)) mpAnimationController->setEnabled(isEnabled); |
| 1963 | |
| 1964 | if (auto animGroup = widget.group("Animations")) |
| 1965 | { |
| 1966 | mpAnimationController->renderUI(animGroup); |
| 1967 | } |
| 1968 | } |
| 1969 | |
| 1970 | auto camera = mCameras[mSelectedCamera]; |
| 1971 | if (camera->hasAnimation()) |
| 1972 | { |
| 1973 | bool isAnimated = camera->isAnimated(); |
| 1974 | if (widget.checkbox("Animate Camera", isAnimated)) camera->setIsAnimated(isAnimated); |
| 1975 | } |
| 1976 | |
| 1977 | auto upDirection = getUpDirection(); |
| 1978 | if (widget.dropdown("Up Direction", kUpDirectionList, reinterpret_cast<uint32_t&>(upDirection))) |
| 1979 | { |
| 1980 | setUpDirection(upDirection); |
| 1981 | } |
| 1982 | |
| 1983 | auto cameraControllerType = getCameraControllerType(); |
| 1984 | if (widget.dropdown("Camera Controller", kCameraControllerTypeList, reinterpret_cast<uint32_t&>(cameraControllerType))) |
| 1985 | { |
| 1986 | setCameraController(cameraControllerType); |
| 1987 | } |
| 1988 | |
| 1989 | if (widget.var("Camera Speed", mCameraSpeed, 0.f, std::numeric_limits<float>::max(), 0.01f)) |
| 1990 | { |
| 1991 | mpCamCtrl->setCameraSpeed(mCameraSpeed); |
| 1992 | } |
| 1993 | |
| 1994 | if (mCameraList.size() > 1) |
| 1995 | { |
| 1996 | uint32_t camIndex = mSelectedCamera; |
| 1997 | if (widget.dropdown("Selected Camera", mCameraList, camIndex)) selectCamera(camIndex); |
| 1998 | } |
| 1999 | |
| 2000 | if (widget.button("Add Viewpoint")) addViewpoint(); |
| 2001 | |
| 2002 | if (mViewpoints.size() > 1) |
| 2003 | { |
| 2004 | if (widget.button("Remove Viewpoint", true)) removeViewpoint(); |
| 2005 | |
| 2006 | static uint32_t animationLength = 30; |
| 2007 | widget.var("Animation Length", animationLength, 1u, 120u); |
| 2008 | |
| 2009 | if (widget.button("Save Viewpoints")) |
| 2010 | { |
| 2011 | static const FileDialogFilterVec kFileExtensionFilters = { { "txt", "Text Files"} }; |
| 2012 | std::filesystem::path path = "cameraPath.txt"; |
| 2013 | if (saveFileDialog(kFileExtensionFilters, path)) |
| 2014 | { |
no test coverage detected