Skip to content

Commit b9ef809

Browse files
author
Rafael Pastrana
committed
pull request changes 2
1 parent e1c9911 commit b9ef809

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/compas/robots/resources/basic.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class DefaultMeshLoader(AbstractMeshLoader):
6565

6666
def __init__(self, **kwargs):
6767
super(DefaultMeshLoader, self).__init__()
68-
self.attr = dict() or kwargs
68+
self.attr = kwargs or dict()
6969

7070
def can_load_mesh(self, url):
7171
"""Determine whether this loader can load a given mesh URL.
@@ -82,7 +82,7 @@ def can_load_mesh(self, url):
8282
Otherwise ``False``.
8383
"""
8484

85-
url = self._get_local_path(url) or url
85+
url = self._get_local_path(url)
8686
scheme = urlparse(url).scheme
8787

8888
# Local files have either:
@@ -112,13 +112,14 @@ def load_mesh(self, url):
112112
:class:`Mesh`
113113
Instance of a mesh.
114114
"""
115-
if url.startswith('file:///'):
116-
url = url[8:]
117-
115+
# if url.startswith('file:///'):
116+
# url = url[8:]
117+
118+
url = self._get_local_path(url)
118119
return _mesh_import(url, url)
119120

120121
def _get_local_path(self, url):
121-
"""Concatenates filepath directory to URL only if defined in the keyword arguments.
122+
"""Concatenates basepath directory to URL only if defined in the keyword arguments.
122123
123124
Parameters
124125
----------
@@ -128,12 +129,17 @@ def _get_local_path(self, url):
128129
Returns
129130
-------
130131
url: str
131-
Extended mesh location if filepath in kwargs.
132-
Else, ir returns None.
132+
Extended mesh location if basepath in kwargs.
133+
Else, it returns None.
133134
"""
134-
filepath = self.attr.get('filepath')
135-
if filepath:
136-
return os.path.join(filepath, url)
135+
if url.startswith('file:///'):
136+
url = url[8:]
137+
138+
basepath = self.attr.get('basepath')
139+
if basepath:
140+
return os.path.join(basepath, url)
141+
142+
return url
137143

138144

139145
def _get_file_format(url):

0 commit comments

Comments
 (0)