Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iterator methods to container-like classes #1644

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Add iterator methods to container-like classes #1644

merged 1 commit into from
Jan 6, 2022

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented Jan 6, 2022

Summary:

Here is an example of changing the alpha value of a skeleton before and after the change:

// Without the change
for (auto i = 0u; skel->getNumBodyNodes(i); ++i)
{
  auto body = skel->getBodyNode(i);
  for (auto& shapeNode : body->getShapeNodesWith<VisualAspect>())
    shapeNode->getVisualAspect()->setAlpha(0.5);
}

// With the change
skel->eachBodyNode([](BodyNode* body) {
  body->eachShapeNodeWith<VisualAspect>([](ShapeNode* shapeNode) {
      shapeNode->getVisualAspect()->setAlpha(0.5);
  });
});

// or
skel->setAlpha(0.5);

Before creating a pull request

  • Document new methods and classes
  • Format new code files using ClangFormat by running make format
  • Build with -DDART_TREAT_WARNINGS_AS_ERRORS=ON and resolve all the compile warnings

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

@jslee02 jslee02 added this to the DART 6.13.0 milestone Jan 6, 2022
@jslee02 jslee02 force-pushed the set_color branch 4 times, most recently from cdc1886 to 676e328 Compare January 6, 2022 03:51
@codecov
Copy link

codecov bot commented Jan 6, 2022

Codecov Report

Merging #1644 (c67aa60) into main (5ef8c1f) will decrease coverage by 0.00%.
The diff coverage is 77.61%.

@@            Coverage Diff             @@
##             main    #1644      +/-   ##
==========================================
- Coverage   59.12%   59.12%   -0.01%     
==========================================
  Files         493      494       +1     
  Lines       40714    40766      +52     
==========================================
+ Hits        24072    24101      +29     
- Misses      16642    16665      +23     
Impacted Files Coverage Δ
dart/dynamics/BodyNode.hpp 100.00% <ø> (ø)
dart/dynamics/MetaSkeleton.cpp 44.88% <0.00%> (-0.72%) ⬇️
dart/dynamics/MetaSkeleton.hpp 100.00% <ø> (ø)
dart/dynamics/detail/BasicNodeManager.hpp 27.65% <ø> (ø)
dart/utils/DartResourceRetriever.hpp 100.00% <ø> (ø)
dart/utils/PackageResourceRetriever.hpp 100.00% <ø> (ø)
dart/dynamics/BodyNode.cpp 78.83% <24.00%> (-0.96%) ⬇️
dart/collision/detail/CollisionGroup.hpp 70.00% <80.00%> (-1.12%) ⬇️
python/dartpy/dynamics/MetaSkeleton.cpp 54.50% <85.71%> (+0.23%) ⬆️
dart/dynamics/detail/BodyNode.hpp 96.62% <96.42%> (-0.97%) ⬇️
... and 9 more

@jslee02 jslee02 marked this pull request as ready for review January 6, 2022 08:26
@jslee02 jslee02 merged commit f07186f into main Jan 6, 2022
@jslee02 jslee02 deleted the set_color branch January 6, 2022 08:43
@jslee02 jslee02 linked an issue Jan 6, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistent interface of container class for element access
1 participant