Skip to content

Conversation

@mahit2609
Copy link

Fix Blender SDF Export Tool for Blender 4.2.3
Overview
This PR fixes compatibility issues with Blender 4.2.3, as the original code was non-functional in newer Blender versions. The changes include API updates and bug fixes to ensure proper functionality.
Key Changes

Updated code to work with Blender 4.2.3's API
Fixed broken light handling and material processing
Updated type checks and property access to match current Blender standards

Notes

Tested working on Blender 4.2.3
Previous version was non-functional on newer Blender releases
Maintains same export format for model.dae, model.sdf, and model.config files

@mahit2609 mahit2609 requested a review from mjcarroll as a code owner November 16, 2024 18:06
@github-actions github-actions bot added 🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty labels Nov 16, 2024
Copy link
Contributor

@azeey azeey 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 contribution. Would you mind signing-off on your commits (see contributing guide.

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Thanks again for the contribution! I started reviewing it, but I quickly realized there are a lot of unrelated changes (e.g. style, removed comments, etc.) that make it harder to review. Could you please revert those changes keeping only the relevant changes that fix the bugs so the PR is as small as possible?

filter_folder=True,
filemode=8,
)
bpy.ops.wm.collada_export(filepath=prefix_path+meshes_folder_prefix+dae_filename,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the path.join here? That is preferred over using + for paths. And since there aren't any other changes, could you revert this to the previous version to reduce the diff as much as possible.

Comment on lines 11 to 17
dae_filename = 'model.dae'
sdf_filename = 'model.sdf'
model_config_filename = 'model.config'
lightmap_filename = 'LightmapBaked.png'
model_name = 'my_model'
meshes_folder_prefix = 'meshes/'

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to remove the extra space. Please revert and minimize the diff.


########################################################################################################################
### Exports model.dae of the scene with textures, its corresponding model.sdf file, and a default model.config file ####
########################################################################################################################
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for removing this comment?

#### export sdf xml based off the scene #####
#############################################
sdf = ET.Element("sdf", attrib={"version": "1.8"})
mesh_objects = [o for o in objects if o.type == 'MESH']
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert unnecessary changes. This is only changing double quotes to single quotes. The rest of the file uses double quotes and I think it's best to stick with that.

@azeey azeey self-assigned this Jan 7, 2025
@mahit2609 mahit2609 force-pushed the gz-sim9 branch 3 times, most recently from d7a295a to f8df892 Compare January 25, 2025 14:56
Copy link
Author

@mahit2609 mahit2609 left a comment

Choose a reason for hiding this comment

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

i have made those changes and tested it on all the 4. versions of the blender can u please go through it i have kept it intact as much as i could thnx for the guidance

Copy link
Contributor

@azeey azeey 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 contribution. I only have one small comment.

@azeey azeey added this to the Jetty Release milestone Jul 28, 2025
@azeey azeey removed the 🪵 jetty Gazebo Jetty label Aug 7, 2025
@azeey azeey changed the title bugs in sdf_exporter.py Fix sdf_exporter.py to be compatible with newer versions of Blender Aug 8, 2025
@azeey
Copy link
Contributor

azeey commented Aug 8, 2025

@mahit2609, can you please rebase on the latest gz-sim9 branch and signoff all your commits. The DCO is still failing:
https://github.com/gazebosim/gz-sim/pull/2678/checks?check_run_id=37546491938

To add your Signed-off-by line to every commit in this branch:

Ensure you have a local copy of your branch by [checking out the pull request locally via command line](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally).
In your local branch, run: git rebase HEAD~3 --signoff
Force push your changes to overwrite the branch: git push --force-with-lease origin gz-sim9

Summary
Commit sha: [629adf6](https://github.com/gazebosim/gz-sim/pull/2678/commits/629adf67d0114b9e6d86dbf78adfaaf5af468c77), Author: mahit2609, Committer: mahit2609; The sign-off is missing.

@azeey azeey removed this from the Jetty Release milestone Aug 11, 2025
@mahit2609 mahit2609 requested a review from arjo129 as a code owner August 19, 2025 19:19
Signed-off-by: mahit2609<mahitgeozujames@gmail.com>

Signed-off-by: mahit2609 <mahitgeozujames@gmail.com>
@mahit2609
Copy link
Author

@azeey the DCO is fixed now , Apologies for the delay. I was dealing with some personal/health issues and was very busy. Thank you for your patience!

Signed-off-by: mahit2609 <mahitgeozujames@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏛️ ionic Gazebo Ionic

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants