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

Added Material Python interface #948

Merged
merged 12 commits into from
Apr 18, 2022
Merged

Added Material Python interface #948

merged 12 commits into from
Apr 18, 2022

Conversation

ahcorde
Copy link
Collaborator

@ahcorde ahcorde commented Apr 6, 2022

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

from sdformat import Material

material = Material()

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde added the scripting Scripting interfaces to Ignition label Apr 6, 2022
@ahcorde ahcorde requested review from azeey and scpeters as code owners April 6, 2022 16:42
@ahcorde ahcorde self-assigned this Apr 6, 2022
@ahcorde ahcorde mentioned this pull request Apr 6, 2022
62 tasks
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Apr 6, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2022

Codecov Report

Merging #948 (1418c91) into main (e363110) will not change coverage.
The diff coverage is n/a.

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e363110...1418c91. Read the comment docs.

"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 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Get the emissive color. The ambient color is "
"Get the emissive color. The emissive color is "

import unittest


class GeometryTEST(unittest.TestCase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class GeometryTEST(unittest.TestCase):
class MaterialTEST(unittest.TestCase):

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 224 to 240
# 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())
Copy link
Collaborator

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7b42ea9

Also added a test for deepcopy in d9a68bf

azeey added 3 commits April 15, 2022 18:38
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")
Copy link
Collaborator

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?

@ahcorde
Copy link
Collaborator Author

ahcorde commented Apr 18, 2022

@osrf-jenkins retest this please

@ahcorde ahcorde requested a review from azeey April 18, 2022 08:18
@ahcorde ahcorde enabled auto-merge (squash) April 18, 2022 08:19
@ahcorde ahcorde merged commit 0494785 into main Apr 18, 2022
@ahcorde ahcorde deleted the ahcorde/python/material branch April 18, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden mujoco scripting Scripting interfaces to Ignition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants