Skip to content

Commit

Permalink
Merge pull request #45 from cyberbotics/enhancement-optionnal-collada
Browse files Browse the repository at this point in the history
Make collada dependency optionnal
  • Loading branch information
DavidMansolino authored Jul 3, 2020
2 parents f64dd20 + f9e63ee commit d796983
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion urdf2webots/parserURDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
sys.stderr.write("pip install pillow\n")
raise e

from collada import Collada
import numbers

from urdf2webots.gazebo_materials import materials
from urdf2webots.math_utils import convertRPYtoEulerAxis

try:
from collada import Collada
colladaIsAvailable = True
except ImportError:
colladaIsAvailable = False

counter = 0

Expand Down Expand Up @@ -466,6 +470,11 @@ def getOBJMesh(filename, node):

def getColladaMesh(filename, node, link):
"""Read collada file."""
if not colladaIsAvailable:
sys.stderr.write('Collada module not found, please install it with:\n')
sys.stderr.write(' python -m pip install pycollada\n')
sys.stderr.write('Skipping "%s"\n' % filename)
return
print('Parsing Mesh: ' + filename)
colladaMesh = Collada(filename)
index = -1
Expand Down

0 comments on commit d796983

Please sign in to comment.