Skip to content
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
2 changes: 1 addition & 1 deletion get_local_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
from __future__ import print_function

import sys
Expand Down
16 changes: 8 additions & 8 deletions webify_models_v2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3

# A script to update gazebo models to be web-friendly.
# It converts all textures to png format and make sure they are
Expand Down Expand Up @@ -56,14 +56,14 @@

if texture_dir != dest_dir:
cmd = ['mv', dest_path, texture_dir]
print cmd
print(cmd)
subprocess.check_call(cmd)

# update texture path in dae files
if format.lower() in ['dae']:
sed_cmd = ["sed", "-i", "-e",
's/\(\.tga\|\.tiff\|\.tif\|\.jpg\|\.jpeg\|\.gif\)/\.png/g', file]
print sed_cmd
print(sed_cmd)
subprocess.check_call(sed_cmd)

# find relatvie path to texture dir
Expand All @@ -79,21 +79,21 @@
# replace dae file png references to texture path
sed_cmd = ["sed", "-i","-e",
's/\(>\)\(.*\/\)\(.*\.png\)/\\1'+ relative_path + 'materials\/textures\/\\3/g', file]
print sed_cmd
print(sed_cmd)
subprocess.check_call(sed_cmd)

sed_cmd = ["sed", "-i","-e",
'/[a-zA-Z0-9_\.\/\-]\+materials\/textures/!s/\([a-zA-Z0-9_\-]\+\)\(\.png\W\)/'+ relative_path + 'materials\/textures\/\\1\\2/g', file]

print sed_cmd
print(sed_cmd)
subprocess.check_call(sed_cmd)

if format.lower() in ['material', 'txt', 'sdf']:
sed_cmd = ["sed", "-i", "-e",
's/\(\.tga\|\.tiff\|\.tif\|\.jpg\|\.jpeg\|\.gif\)/\.png/g', file]
print sed_cmd
print(sed_cmd)
subprocess.check_call(sed_cmd)

except Exception, e:
print "error %s" % e
except Exception as e:
print("error %s" % e)
raise