Skip to content

Commit

Permalink
fix ids is None case
Browse files Browse the repository at this point in the history
  • Loading branch information
xiuliren committed Apr 8, 2020
1 parent 1275984 commit 2c2ac30
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions chunkflow/flow/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def __init__(self,
self.output_format = output_format
self.dust_threshold = dust_threshold
self.manifest = manifest

self.ids = ids

if manifest:
assert output_format == 'precomputed'

Expand All @@ -86,18 +87,19 @@ def __init__(self,

self.storage = Storage(mesh_path)

if ids.endswith('.json'):
# assume that ids is a json file in the storage path
json_storage = Storage(output_path)
ids_str = json_storage.get_file(ids)
self.ids = set(json.loads(ids_str))
assert len(self.ids) > 0
if self.verbose:
print(f'number of selected objects: {len(self.ids)}')
else:
# a simple string, like "34,45,56,23"
# this is used for small object numbers
self.ids = set([int(id) for id in ids.split(',')])
if ids:
if ids.endswith('.json'):
# assume that ids is a json file in the storage path
json_storage = Storage(output_path)
ids_str = json_storage.get_file(ids)
self.ids = set(json.loads(ids_str))
assert len(self.ids) > 0
if self.verbose:
print(f'number of selected objects: {len(self.ids)}')
else:
# a simple string, like "34,45,56,23"
# this is used for small object numbers
self.ids = set([int(id) for id in ids.split(',')])

def _get_mesh_data(self, obj_id, offset):
mesh = self.mesher.get_mesh(
Expand Down

0 comments on commit 2c2ac30

Please sign in to comment.