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

Remove ClearMaterialsCache call when a material is destroyed in ogre2 #1110

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Feb 27, 2025

🦟 Bug fix

Summary

The material cache in Ogre2MeshFactory was introduced in #324 to clear material objects when a mesh is removed. Looking at the current state, this call should no longer be needed as we now have logic in Ogre2Material::Destroy function to destroy ogre internal material / texture objects (and also unregistering gz-rendering material objects) when they are not in use. So this PR removes the material cache and the the call to ClearMaterialCache function.

Note that we ran into an issue with the ClearMaterialsCache function. It clears materials by the name of the texture it contains. However, it's possible for multiple materials to use the same texture, and the current logic may incorrectly destroy the wrong material. Removing the call to ClearMaterialsCache resolves that issue.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • 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: Ian Chen <ichen@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
@github-actions github-actions bot added 🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty labels Feb 27, 2025
@iche033 iche033 merged commit 597d889 into gz-rendering9 Feb 27, 2025
12 of 13 checks passed
@iche033 iche033 deleted the clear_materials_ogre2 branch February 27, 2025 17:49
@iche033
Copy link
Contributor Author

iche033 commented Feb 27, 2025

@Mergifyio backport gz-rendering8

Copy link

mergify bot commented Feb 27, 2025

backport gz-rendering8

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 27, 2025
…#1110)

Signed-off-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 597d889)
iche033 added a commit that referenced this pull request Feb 27, 2025
…#1110)

Signed-off-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 597d889)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants