owl-project / NVISII

Apache License 2.0
330 stars 28 forks source link

Seg fault for access entities of a large obj file scene. #110

Open TontonTremblay opened 3 years ago

TontonTremblay commented 3 years ago
toys = visii.import_scene(PATH,
    visii.vec3(0,0,0),
    visii.vec3(0.01,0.01,0.01),
    visii.angleAxis(1.57, visii.vec3(1,0,0))
    )
print(len(toys.entities))

for entity_name in visii.entity.get_name_to_id_map():
    if entity_name == 'camera':
        continue
    entity = visii.entity.get(entity_name)
    mat_name = entity.get_material().get_name() # THIS CRASHES
    if colours[mat_name]['alpha']<1:
        entity.set_visibility(shadow = False)
        # print(entity.get_name())
        # entity.set_visibility(False)
natevm commented 3 years ago

You appear to be using ViSII instead of nvisii. Does this issue occur with nvisii?

TontonTremblay commented 3 years ago

Yes this is on nvisii.

On Fri, Jun 11, 2021 at 19:13 Nathan V. Morrical @.***> wrote:

You appear to be using ViSII instead of nvisii. Does this issue occur with nvisii?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/owl-project/NVISII/issues/110#issuecomment-859982871, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK6JID44SDNJTGK353XEN3TSK7C5ANCNFSM46RY4DYA .

TontonTremblay commented 3 years ago

This problem is caused by returning a list of entities that is too large. Work around for now is to load the obj file as a text file and create the list from the objects in the file.

# find the entity names
with open(obj_to_load) as f:
    lines = f.readlines()

entity_names = []

for line in lines: 
    if line[0] == 'o':
        name = line.split(' ')[-1].replace("\n","")
        entity_names.append(f"{name}_{name}")
# print(entity_names)

nvisii writes a scene from an obj file as its name twice.