From 9911c3299986d5238e4625e8bd4099b4f380f013 Mon Sep 17 00:00:00 2001 From: Simon Schmeisser Date: Thu, 27 Apr 2023 15:40:56 +0200 Subject: [PATCH] Ogre 13 compatibility - Adapt to new createSceneManager - Add missing deque include - Ogre::UTFString was removed in 13.0 - CI: Add Ogre 13.6 --- .github/workflows/ci.yaml | 4 ++++ src/image_view/image_view.cpp | 5 +++++ src/rviz/default_plugin/covariance_property.h | 2 ++ src/rviz/default_plugin/image_display.cpp | 5 +++++ src/rviz/image/ros_image_texture.h | 1 + src/rviz/ogre_helpers/apply_visibility_bits.cpp | 1 + src/rviz/ogre_helpers/movable_text.cpp | 6 ++++++ src/rviz/visualization_manager.cpp | 5 ++++- src/test/render_points_test.cpp | 5 +++++ src/test/two_render_widgets.cpp | 5 +++++ 10 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 022ced9699..5f47c0cb7d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,10 +26,14 @@ jobs: ogre: 1.12 qt: 6 cxxflags: -Wno-deprecated-declarations -Werror + - distro: noetic + ogre: 13.6 + qt: 5 env: CXXFLAGS: "-DRVIZ_DEPRECATE_QT4_SLOTS -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-strict-aliasing -Wno-sign-compare ${{ matrix.cxxflags}}" UPSTREAM_WORKSPACE: ${{ matrix.distro != 'jammy' && 'github:rhaschke/python_qt_binding#silent-external-warnings' || '' }} + AFTER_INIT: ${{ startsWith(matrix.ogre, '13') && 'apt install -q -y software-properties-common && add-apt-repository ppa:s-schmeisser/ogre-13-focal -y' || ''}} AFTER_INSTALL_TARGET_DEPENDENCIES: apt install -qq -y libogre-${{ matrix.ogre }}-dev CATKIN_LINT: true CMAKE_ARGS: -DRVIZ_QT_VERSIONS="${{ matrix.qt }}" diff --git a/src/image_view/image_view.cpp b/src/image_view/image_view.cpp index 3ade801f25..904bf3f7ba 100644 --- a/src/image_view/image_view.cpp +++ b/src/image_view/image_view.cpp @@ -58,7 +58,12 @@ using namespace rviz; ImageView::ImageView(QWidget* parent) : QtOgreRenderWindow(parent), texture_it_(nh_) { setAutoRender(false); +#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0)) scene_manager_ = ogre_root_->createSceneManager(Ogre::ST_GENERIC, "TestSceneManager"); +#else + scene_manager_ = ogre_root_->createSceneManager(Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME, + "TestSceneManager"); +#endif } ImageView::~ImageView() diff --git a/src/rviz/default_plugin/covariance_property.h b/src/rviz/default_plugin/covariance_property.h index eae8247116..d1a0999de6 100644 --- a/src/rviz/default_plugin/covariance_property.h +++ b/src/rviz/default_plugin/covariance_property.h @@ -30,6 +30,8 @@ #ifndef COVARIANCE_PROPERTY_H #define COVARIANCE_PROPERTY_H +#include + #include #include diff --git a/src/rviz/default_plugin/image_display.cpp b/src/rviz/default_plugin/image_display.cpp index 91847beddd..8efe0e1719 100644 --- a/src/rviz/default_plugin/image_display.cpp +++ b/src/rviz/default_plugin/image_display.cpp @@ -81,7 +81,12 @@ void ImageDisplay::onInitialize() static uint32_t count = 0; std::stringstream ss; ss << "ImageDisplay" << count++; +#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0)) img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, ss.str()); +#else + img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager( + Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME, ss.str()); +#endif } img_scene_node_ = img_scene_manager_->getRootSceneNode()->createChildSceneNode(); diff --git a/src/rviz/image/ros_image_texture.h b/src/rviz/image/ros_image_texture.h index 55d7769390..161cc0dc3b 100644 --- a/src/rviz/image/ros_image_texture.h +++ b/src/rviz/image/ros_image_texture.h @@ -41,6 +41,7 @@ #include +#include #include namespace rviz diff --git a/src/rviz/ogre_helpers/apply_visibility_bits.cpp b/src/rviz/ogre_helpers/apply_visibility_bits.cpp index 674795e8d5..5bb051e97d 100644 --- a/src/rviz/ogre_helpers/apply_visibility_bits.cpp +++ b/src/rviz/ogre_helpers/apply_visibility_bits.cpp @@ -31,6 +31,7 @@ #include #include +#include namespace rviz { diff --git a/src/rviz/ogre_helpers/movable_text.cpp b/src/rviz/ogre_helpers/movable_text.cpp index 6a516d4af0..b17c55eae2 100644 --- a/src/rviz/ogre_helpers/movable_text.cpp +++ b/src/rviz/ogre_helpers/movable_text.cpp @@ -51,7 +51,9 @@ #include #include #include +#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0)) #include +#endif #include @@ -215,7 +217,11 @@ void MovableText::showOnTop(bool show) void MovableText::_setupGeometry() { +#if (OGRE_VERSION >= OGRE_VERSION_CHECK(13, 0, 0)) + Ogre::String utfCaption(mCaption); +#else Ogre::UTFString::utf32string utfCaption(Ogre::UTFString(mCaption).asUTF32()); +#endif assert(mpFont); assert(!mpMaterial.isNull()); diff --git a/src/rviz/visualization_manager.cpp b/src/rviz/visualization_manager.cpp index 9bdb7ac63e..fdae05a366 100644 --- a/src/rviz/visualization_manager.cpp +++ b/src/rviz/visualization_manager.cpp @@ -140,8 +140,11 @@ VisualizationManager::VisualizationManager(RenderPanel* render_panel, render_panel->setAutoRender(false); private_->threaded_nh_.setCallbackQueue(&private_->threaded_queue_); - +#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0)) scene_manager_ = ogre_root_->createSceneManager(Ogre::ST_GENERIC); +#else + scene_manager_ = ogre_root_->createSceneManager(); +#endif rviz::RenderSystem::RenderSystem::get()->prepareOverlays(scene_manager_); diff --git a/src/test/render_points_test.cpp b/src/test/render_points_test.cpp index 63c3ec44aa..6501c1ddc7 100644 --- a/src/test/render_points_test.cpp +++ b/src/test/render_points_test.cpp @@ -52,7 +52,12 @@ MyFrame::MyFrame(QWidget* parent) try { +#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0)) scene_manager_ = root_->createSceneManager(Ogre::ST_GENERIC, "TestSceneManager"); +#else + scene_manager_ = root_->createSceneManager(Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME, + "TestSceneManager"); +#endif render_panel_ = new QtOgreRenderWindow(); render_panel_->resize(this->size()); diff --git a/src/test/two_render_widgets.cpp b/src/test/two_render_widgets.cpp index fa0d938d66..5d2d7507c4 100644 --- a/src/test/two_render_widgets.cpp +++ b/src/test/two_render_widgets.cpp @@ -27,6 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include @@ -68,7 +69,11 @@ int main(int argc, char** argv) container.show(); // Make a scene and show it in the window. +#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0)) Ogre::SceneManager* scene_manager = render_system->root()->createSceneManager(Ogre::ST_GENERIC); +#else + Ogre::SceneManager* scene_manager = render_system->root()->createSceneManager(); +#endif Ogre::Entity* thing = scene_manager->createEntity("thing", "rviz_cone.mesh"); Ogre::SceneNode* node = scene_manager->getRootSceneNode()->createChildSceneNode();