-
Notifications
You must be signed in to change notification settings - Fork 98
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
updated loading //material colors #519
Conversation
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Codecov Report
@@ Coverage Diff @@
## master #519 +/- ##
==========================================
+ Coverage 87.97% 88.01% +0.04%
==========================================
Files 66 66
Lines 9546 9579 +33
==========================================
+ Hits 8398 8431 +33
Misses 1148 1148
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Can you add a test where a file is being read through the most frequently used user API sdf::Root::Load
?
src/Material_TEST.cc
Outdated
|
||
sdf::Material material; | ||
sdf::Errors errors = material.Load(elem); | ||
PrintErrors(errors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tip: You should be able to do std::cout << errors << std::endl;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
When working on the integration test I realized that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment about exceptions, otherwise looks great!
src/Param.cc
Outdated
c = std::stof(token); | ||
colors.push_back(c); | ||
} | ||
catch(const std::exception &/*e*/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the caught exception be more specific like the ones in ValueFromString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! dbf7614
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
🦟 Bug fix
Fixes #193
Summary
This fix parses
//material
color components (i.e., ambient, diffuse, specular, emissive) from a SDFormat file inMaterial::Load
by checking that values are eitherr,g,b
orr,g,b,a
(expecting 3 or 4 values) and that each value is between [0,1]. If the checks do not pass, the default color0,0,0,1
is used.Checklist
sh tools/code_check.sh
)test coverage)
another open pull request
to support the maintainers
Note to maintainers: Remember to use Squash-Merge