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

Fix tutorial for blender_sdf_exporter #1718

Merged
merged 5 commits into from
Oct 10, 2022
Merged

Fix tutorial for blender_sdf_exporter #1718

merged 5 commits into from
Oct 10, 2022

Conversation

AndrejOrsula
Copy link
Contributor

🦟 Bug fix

Summary

I encountered 2 issues when trying the tutorial.

  1. The COLLADA (.dae) would get exported correctly under ./meshes/model.dae. However, SDF file refer to ./model.dae as a relative URI for the mesh, which prevented Gazebo from finding it (assuming that only the parent directory of the model is part of GZ_SIM_RESOURCE_PATH). Corrected the path.
  2. The script always expected a model to have an assigned material, which would make it fail for objects without any material. Added a simple check to prevent throwing an exception when exporting models without a material.

Tested both with Blender 2.82 and 3.2

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: Andrej Orsula <orsula.andrej@gmail.com>
Copy link
Contributor

@mabelzhang mabelzhang left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes! For consistency, we should make the same fixes in a few other places in the script. I found a few, but that might not be all of them.

@@ -22,7 +22,7 @@ def export_sdf(prefix_path):
meshes_folder_prefix = 'meshes/'

# Exports the dae file and its associated textures
bpy.ops.wm.collada_export(filepath=prefix_path+meshes_folder_prefix+dae_filename, check_existing=False, filter_blender=False, filter_image=False, filter_movie=False, filter_python=False, filter_font=False, filter_sound=False, filter_text=False, filter_btx=False, filter_collada=True, filter_folder=True, filemode=8)
bpy.ops.wm.collada_export(filepath=os.path.join(prefix_path, meshes_folder_prefix, dae_filename), check_existing=False, filter_blender=False, filter_image=False, filter_movie=False, filter_python=False, filter_font=False, filter_sound=False, filter_text=False, filter_btx=False, filter_collada=True, filter_folder=True, filemode=8)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to break this long line into 80-character lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I formatted everything via the last commit e17968b using isort and black with default settings.

Originally, I did not want to do this because of the number of changes this generates (although this commit fixes a lot of things like quote and indentation inconsistency). Please, let me know if I should revert it and fix only the line lengths.

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Merging #1718 (e17968b) into gz-sim7 (0df8e9e) will increase coverage by 0.29%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           gz-sim7    #1718      +/-   ##
===========================================
+ Coverage    63.93%   64.22%   +0.29%     
===========================================
  Files          334      336       +2     
  Lines        26333    26567     +234     
===========================================
+ Hits         16836    17063     +227     
- Misses        9497     9504       +7     
Impacted Files Coverage Δ
src/systems/wind_effects/WindEffects.cc 77.82% <0.00%> (-1.09%) ⬇️
src/EntityComponentManager.cc 90.04% <0.00%> (-0.88%) ⬇️
src/systems/scene_broadcaster/SceneBroadcaster.cc 92.21% <0.00%> (-0.27%) ⬇️
src/rendering/RenderUtil.cc 38.80% <0.00%> (-0.14%) ⬇️
src/systems/physics/Physics.cc 65.79% <0.00%> (-0.08%) ⬇️
src/SdfEntityCreator.cc 85.55% <0.00%> (ø)
...stems/joint_state_publisher/JointStatePublisher.hh 100.00% <0.00%> (ø)
src/systems/hydrodynamics/Hydrodynamics.cc 89.26% <0.00%> (ø)
src/systems/acoustic_comms/AcousticComms.cc 93.22% <0.00%> (ø)
src/ServerPrivate.cc 82.96% <0.00%> (+0.15%) ⬆️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@nkoenig nkoenig merged commit 6f912e3 into gazebosim:gz-sim7 Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants