Skip to content

Commit

Permalink
fix bug in motion blur export of shared meshes (fixes #206)
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Nov 12, 2018
1 parent 4c13423 commit 9cda5a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion export/blender_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def convert(exporter, obj, scene, context, luxcore_scene,
if update_shared_mesh:
exporter.shared_meshes[mesh_key] = mesh_definitions

return props, ExportedObject(mesh_definitions)
return props, ExportedObject(mesh_definitions, luxcore_name)
except Exception as error:
msg = 'Object "%s": %s' % (obj.name, error)
scene.luxcore.errorlog.add_warning(msg)
Expand Down
2 changes: 1 addition & 1 deletion export/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _convert_area_lamp(obj, scene, context, luxcore_scene, gain, importance, lux

fake_material_index = 0
mesh_definition = [luxcore_name, fake_material_index]
exported_obj = ExportedObject([mesh_definition])
exported_obj = ExportedObject([mesh_definition], luxcore_name)
return props, exported_obj


Expand Down
11 changes: 9 additions & 2 deletions utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@


class ExportedObject(object):
def __init__(self, mesh_definitions):
def __init__(self, mesh_definitions, luxcore_name):
"""
:param luxcore_name: The true base name of this object (without material index suffix). Passed
separately because the names in mesh_definitions are incorrect for shared meshes
"""

# Note that luxcore_names is a list of names (because an object in Blender can have multiple materials,
# while in LuxCore it can have only one material, so we have to split it into multiple LuxCore objects)
self.luxcore_names = [lux_obj_name for lux_obj_name, material_index in mesh_definitions]
self.luxcore_names = []
for _, material_index in mesh_definitions:
self.luxcore_names.append(luxcore_name + "%03d" % material_index)
# list of lists of the form [lux_obj_name, material_index]
self.mesh_definitions = mesh_definitions

Expand Down

0 comments on commit 9cda5a7

Please sign in to comment.