-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
### What * Fixes #2794 * Part of #2919 Small codegen fix for nested array serialization was required. Adds example & test & roundtrip test for annotation context to C++ Sneaked in: Fixes a few annoyances with VSCode Cpp/CMake config. <img width="1016" alt="image" src="https://github.com/rerun-io/rerun/assets/1220815/31a764bc-cb51-4420-a75f-0da0eb6bfd39"> ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x ] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2948) (if applicable) - [PR Build Summary](https://build.rerun.io/pr/2948) - [Docs preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Fannotation-context/docs) - [Examples preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Fannotation-context/examples)
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Log an annotation context to assign a label and color to each class | ||
|
||
#include <rerun.hpp> | ||
|
||
namespace rr = rerun; | ||
|
||
int main() { | ||
auto rr_stream = rr::RecordingStream("annotation_context_rects"); | ||
rr_stream.connect("127.0.0.1:9876"); | ||
|
||
// Log an annotation context to assign a label and color to each class | ||
rr_stream.log( | ||
"/", | ||
rr::archetypes::AnnotationContext({ | ||
rr::datatypes::AnnotationInfo(1, "red", rr::components::Color(255, 0, 0)), | ||
rr::datatypes::AnnotationInfo(2, "green", rr::components::Color(0, 255, 0)), | ||
}) | ||
); | ||
|
||
// Log a batch of 2 arrows with different `class_ids` | ||
rr_stream.log( | ||
"arrows", | ||
rr::archetypes::Arrows3D({{1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}}).with_class_ids({1, 2}) | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <utility> | ||
#include "annotation_context.hpp" | ||
|
||
// Uncomment for better auto-complete while editing the extension. | ||
// #define EDIT_EXTENSION | ||
|
||
namespace rerun { | ||
namespace components { | ||
#ifdef EDIT_EXTENSION | ||
struct AnnotationContextExt { | ||
std::vector<rerun::datatypes::ClassDescriptionMapElem> class_map; | ||
|
||
#define AnnotationContext AnnotationContextExt | ||
|
||
// [CODEGEN COPY TO HEADER START] | ||
|
||
AnnotationContext( | ||
std::initializer_list<rerun::datatypes::ClassDescription> class_descriptions | ||
) { | ||
class_map.reserve(class_descriptions.size()); | ||
for (const auto& class_description : class_descriptions) { | ||
class_map.emplace_back(std::move(class_description)); | ||
} | ||
} | ||
|
||
// [CODEGEN COPY TO HEADER END] | ||
}; | ||
#endif | ||
|
||
} // namespace components | ||
} // namespace rerun |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.