Verified Commit 8d5aee63 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python/meshcat: isMesh should be a function

parent 50f49cc7
Pipeline #15218 failed with stage
in 112 minutes and 59 seconds
......@@ -13,6 +13,16 @@ try:
except:
WITH_HPP_FCL_BINDINGS = False
def isMesh(geometry_object):
""" Check whether the geometry object contains a Mesh supported by MeshCat """
if geometry_object.meshPath == "":
return False
_, file_extension = os.path.splitext(geometry_object.meshPath)
if file_extension.lower() in [".dae", ".obj", ".stl"]:
return True
return False
def loadBVH(bvh):
import meshcat.geometry as mg
......@@ -134,17 +144,6 @@ class MeshcatVisualizer(BaseVisualizer):
return obj
def isMesh(self, geometry_object):
""" Check whether the geometry object contains a Mesh supported by MeshCat """
if geometry_object.meshPath == "":
return False
_, file_extension = os.path.splitext(geometry_object.meshPath)
if file_extension.lower() in [".dae", ".obj", ".stl"]:
return True
return False
def loadMesh(self, geometry_object):
import meshcat.geometry
......@@ -179,7 +178,7 @@ class MeshcatVisualizer(BaseVisualizer):
try:
if WITH_HPP_FCL_BINDINGS and isinstance(geometry_object.geometry, hppfcl.ShapeBase):
obj = self.loadPrimitive(geometry_object)
elif self.isMesh(geometry_object):
elif isMesh(geometry_object):
obj = self.loadMesh(geometry_object)
elif WITH_HPP_FCL_BINDINGS and isinstance(geometry_object.geometry, hppfcl.BVHModelBase):
obj = loadBVH(geometry_object.geometry)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment