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 blender sdf export script and remove .material file from collada light export test #923

Merged
merged 2 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions examples/scripts/blender/sdf_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
########################################################################################################################
def export_sdf(prefix_path):

dae_filename = 'meshes/model.dae'
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/'

# Exports the dae file and its associated textures
bpy.ops.wm.collada_export(filepath=prefix_path+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=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)

# objects = bpy.context.selected_objects
objects = bpy.context.selectable_objects
Expand Down Expand Up @@ -71,12 +72,12 @@ def export_sdf(prefix_path):
metal = ET.SubElement(pbr, "metal")
if diffuse_map != "":
albedo_map = ET.SubElement(metal, "albedo_map")
albedo_map.text = diffuse_map
albedo_map.text = meshes_folder_prefix + diffuse_map

# for lightmapping, add the UV and turn off casting of shadows
if os.path.isfile(lightmap_filename):
light_map = ET.SubElement(metal, "light_map", attrib={"uv_set":"1"})
light_map.text = lightmap_filename
light_map.text = meshes_folder_prefix + lightmap_filename

cast_shadows = ET.SubElement(visual, "cast_shadows")
cast_shadows.text = "0"
Expand Down
26 changes: 0 additions & 26 deletions test/worlds/models/building_L1/meshes/model.material

This file was deleted.

8 changes: 0 additions & 8 deletions test/worlds/models/building_L1/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<albedo_map>model://building_L1/meshes/blue_linoleum.png</albedo_map>
</metal>
</pbr>
<script>
<uri>model://building_L1/meshes/</uri>
<name>floor_1_Diffuse</name>
</script>
</material>
</visual>
<collision name="collision">
Expand Down Expand Up @@ -53,10 +49,6 @@
<albedo_map>model://building_L1/meshes/default.png</albedo_map>
</metal>
</pbr>
<script>
<uri>model://building_L1/meshes/</uri>
<name>wall_1_Diffuse</name>
</script>
</material>
</visual>
<collision name="collision">
Expand Down