diff --git a/BUILD.bazel b/BUILD.bazel index 4add695d..925584f0 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -18,6 +18,7 @@ load( "gz_proto_library", ) load("@rules_license//rules:license.bzl", "license") +load("@rules_python//python:proto.bzl", "py_proto_library") package( default_applicable_licenses = [GZ_ROOT + "msgs:license"], @@ -90,6 +91,11 @@ proto_library( ], ) +py_proto_library( + name = "gzmsgs_proto_py_pb2", + deps = [":gzmsgs_proto"] +) + gz_proto_library( name = "gzmsgs_cc_proto", proto_deps = [":gzmsgs_proto"], diff --git a/CMakeLists.txt b/CMakeLists.txt index 6699a128..70451214 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,8 +100,6 @@ set(GZ_UTILS_VER ${gz-utils3_VERSION_MAJOR}) gz_find_package(gz-math8 REQUIRED) set(GZ_MATH_VER ${gz-math8_VERSION_MAJOR}) -find_package(Python3 REQUIRED COMPONENTS Interpreter) - #-------------------------------------- # Find if command is available. This is used to enable tests. # Note that CLI files are installed regardless of whether the dependency is diff --git a/Changelog.md b/Changelog.md index 65f648d6..c82465d4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -60,6 +60,24 @@ ## Gazebo Msgs 10.x +### Gazebo Msgs 10.3.2 (2025-02-10) + +1. cmake extras: only find Python3 if needed + * [Pull request #479](https://github.com/gazebosim/gz-msgs/pull/479) + +### Gazebo Msgs 10.3.1 (2024-11-11) + +1. Add rule to build python version of protos + * [Pull request #474](https://github.com/gazebosim/gz-msgs/pull/474) + +1. Return only unique message types in `MessageFactory::Types` function + * [Pull request #472](https://github.com/gazebosim/gz-msgs/pull/472) + +### Gazebo Msgs 10.3.0 (2024-06-18) + +1. Backport: Adding cone primitives. + * [Pull request #442](https://github.com/gazebosim/gz-msgs/pull/442) + ### Gazebo Msgs 10.2.0 (2024-05-17) 1. CameraTrack message for advanced tracking and following. diff --git a/core/src/MessageFactory.cc b/core/src/MessageFactory.cc index 5597d66d..b1324cc6 100644 --- a/core/src/MessageFactory.cc +++ b/core/src/MessageFactory.cc @@ -15,6 +15,8 @@ * */ +#include + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4146 4251) @@ -60,16 +62,16 @@ MessageFactory::MessagePtr MessageFactory::New( { type = kGzMsgsPrefix + _msgType.substr(8); } - // Convert ".gz_msgs." prefix - else if (_msgType.find(".gz_msgs.") == 0) - { - type = kGzMsgsPrefix + _msgType.substr(9); - } // Convert ".gz.msgs." prefix else if (_msgType.find(".gz.msgs.") == 0) { type = kGzMsgsPrefix + _msgType.substr(9); } + // Convert ".gz_msgs." prefix + else if (_msgType.find(".gz_msgs.") == 0) + { + type = kGzMsgsPrefix + _msgType.substr(9); + } else { type = _msgType; @@ -130,15 +132,21 @@ void MessageFactory::Types(std::vector &_types) { _types.clear(); + // Add the types loaded from descriptor files + std::vector dynTypes; + this->dynamicFactory->Types(dynTypes); + + // Use set to remove duplicates + std::unordered_set typesSet(dynTypes.begin(), dynTypes.end()); + // Return the list of all known message types. std::map::const_iterator iter; for (iter = msgMap.begin(); iter != msgMap.end(); ++iter) { - _types.push_back(iter->first); + typesSet.insert(iter->first); } - // Add the types loaded from descriptor files - this->dynamicFactory->Types(_types); + std::copy(typesSet.begin(), typesSet.end(), std::back_inserter(_types)); } /////////////////////////////////////////////////