-
Notifications
You must be signed in to change notification settings - Fork 107
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
Added Material Python interface #948
Conversation
Signed-off-by: ahcorde <ahcorde@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #948 +/- ##
=======================================
Coverage 66.66% 66.66%
=======================================
Files 2 2
Lines 27 27
=======================================
Hits 18 18
Misses 9 9 Continue to review full report at Codecov.
|
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
python/src/sdf/pyMaterial.cc
Outdated
"specified by a set of three numbers representing red/green/blue, " | ||
"each in the range of [0,1].") | ||
.def("emissive", &sdf::Material::Emissive, | ||
"Get the emissive color. The ambient color is " |
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.
"Get the emissive color. The ambient color is " | |
"Get the emissive color. The emissive color is " |
python/test/pyMaterial_TEST.py
Outdated
import unittest | ||
|
||
|
||
class GeometryTEST(unittest.TestCase): |
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.
class GeometryTEST(unittest.TestCase): | |
class MaterialTEST(unittest.TestCase): |
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.
python/test/pyMaterial_TEST.py
Outdated
# Move the material | ||
moved = material | ||
self.assertEqual(Color(0.1, 0.2, 0.3, 0.5), moved.ambient()) | ||
self.assertEqual(Color(0.2, 0.3, 0.4, 0.6), moved.diffuse()) | ||
self.assertEqual(Color(0.3, 0.4, 0.5, 0.7), moved.specular()) | ||
self.assertEqual(Color(0.4, 0.5, 0.6, 0.8), moved.emissive()) | ||
self.assertFalse(moved.lighting()) | ||
self.assertEqual(5, moved.render_order()) | ||
self.assertTrue(moved.double_sided()) | ||
self.assertEqual("uri", moved.script_uri()) | ||
self.assertEqual("name", moved.script_name()) | ||
self.assertEqual(Material.ShaderType.VERTEX, moved.shader()) | ||
self.assertEqual("map", moved.normal_map()) | ||
# TODO(ahcorde) Add Pbr python interface | ||
# self.assertEqual(workflow, | ||
# *moved.PbrMaterial()->Workflow(sdf::PbrWorkflowType::METAL)) | ||
self.assertEqual("/my/path", moved.file_path()) |
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.
These checks can be removed since there no move assignment in python.
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.
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
return sdf::Material(self); | ||
}, "memo"_a); | ||
|
||
pybind11::enum_<sdf::ShaderType>(materialModule, "ShaderType") |
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.
This enum is in the sdf
namespace in C++, but under sdformat.Material
in python. Should we make them consistent?
@osrf-jenkins retest this please |
Signed-off-by: ahcorde ahcorde@gmail.com
🎉 New feature
This PR is part of this meta ticket #931
Summary
Added Material Python interface
Test it
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.