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

Helper function to get a scene #320

Merged
merged 1 commit into from
May 15, 2021
Merged

Conversation

chapulina
Copy link
Contributor

@chapulina chapulina commented May 8, 2021

🎉 New feature

Summary

Most applications will only have one rendering engine loaded at a time, and only one scene within that. This helper function gets the first scene that can be found in any rendering engine.

This pattern is being repeated on several ign-gui and ign-gazebo plugins, so it would be nice to reduce duplication. For example:

This PR could target ign-rendering3, I'm targeting main because I have other PRs that will depend on it. Once this has been reviewed I can rebase and target 3.

Test it

Take a look at the added tests.

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

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

LGTM, just one minor comment, what do you think about use another name for the method? getFirstInitializedScene ?

I can see an error in windows

47: �[31m[Err] [C:\Jenkins\workspace\ign_rendering-pr-win\ws\ign-rendering\src\RenderEngineManager.cc:336] �[m�[31mInvalid render-engine index: �[m�[31m1000000�[m�[31m
47: �[m[       OK ] RenderingIfaceTest.RegisterEngine (67 ms)

@chapulina
Copy link
Contributor Author

what do you think about use another name for the method? getFirstInitializedScene ?

I don't know if that name would be necessarily true for the current implementation. For example:

  1. Register engine EA
  2. Register engine EB
  3. Create scene on SB on EB
  4. Create scene on SA on EA

SB was initialized before SA, but we'll return SA. Moreover, if we don't do step 4, we will return null.

@ahcorde
Copy link
Contributor

ahcorde commented May 12, 2021

@osrf-jenkins retest this please

@iche033
Copy link
Contributor

iche033 commented May 12, 2021

I don't know if that name would be necessarily true for the current implementation.

How about getFirstRenderEngineScene to be more specific?

@chapulina
Copy link
Contributor Author

How about getFirstRenderEngineScene to be more specific

The trick is whether the "first" applies to the render engine, to the scene, or to both...

I don't have a better suggestion though. I can go with that if you think there isn't a lot of ambiguity. I'd just drop the get.

@iche033
Copy link
Contributor

iche033 commented May 12, 2021

sceneFromFirstRenderEngine?

I think either one works

@chapulina
Copy link
Contributor Author

sceneFromFirstRenderEngine?

Ok, I went with that: e19bd73

Signed-off-by: Louise Poubel <louise@openrobotics.org>
@chapulina chapulina force-pushed the chapulina/6/some_scene branch from e19bd73 to 9ed634a Compare May 14, 2021 22:16
@chapulina chapulina changed the base branch from main to ign-rendering3 May 14, 2021 22:16
@chapulina chapulina added 🏰 citadel Ignition Citadel and removed 🏯 fortress Ignition Fortress labels May 14, 2021
@chapulina
Copy link
Contributor Author

Once this has been reviewed I can rebase and target 3.

Done, this is now targeted at v3

@codecov
Copy link

codecov bot commented May 14, 2021

Codecov Report

Merging #320 (e19bd73) into ign-rendering3 (e3d56ad) will increase coverage by 6.85%.
The diff coverage is 58.36%.

❗ Current head e19bd73 differs from pull request most recent head 9ed634a. Consider uploading reports for the commit 9ed634a to get more accurate results
Impacted file tree graph

@@                Coverage Diff                 @@
##           ign-rendering3     #320      +/-   ##
==================================================
+ Coverage           50.59%   57.44%   +6.85%     
==================================================
  Files                 129      159      +30     
  Lines               11887    15718    +3831     
==================================================
+ Hits                 6014     9029    +3015     
- Misses               5873     6689     +816     
Impacted Files Coverage Δ
include/ignition/rendering/ArrowVisual.hh 100.00% <ø> (+100.00%) ⬆️
include/ignition/rendering/AxisVisual.hh 100.00% <ø> (+100.00%) ⬆️
include/ignition/rendering/Camera.hh 100.00% <ø> (ø)
include/ignition/rendering/CompositeVisual.hh 100.00% <ø> (+100.00%) ⬆️
include/ignition/rendering/Geometry.hh 100.00% <ø> (ø)
include/ignition/rendering/GpuRays.hh 0.00% <ø> (ø)
include/ignition/rendering/Image.hh 100.00% <ø> (ø)
include/ignition/rendering/Light.hh 100.00% <ø> (ø)
include/ignition/rendering/Material.hh 100.00% <ø> (ø)
include/ignition/rendering/Mesh.hh 100.00% <ø> (ø)
... and 144 more

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 e3d56ad...9ed634a. Read the comment docs.

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants