Skip to content

Commit

Permalink
fix a regression (fixes #256)
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Apr 28, 2019
1 parent 676a221 commit 85bf492
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions export/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def convert_lamp(exporter, obj, scene, context, luxcore_scene, dupli_suffix="",
luxcore_name = utils.get_luxcore_name(obj, context) + dupli_suffix

# If this light was previously defined as an area lamp, delete the area lamp mesh
luxcore_scene.DeleteObject(luxcore_name)
luxcore_scene.DeleteObject(_get_area_obj_name(luxcore_name))
# If this light was previously defined as a light, delete it
luxcore_scene.DeleteLight(luxcore_name)

Expand Down Expand Up @@ -377,9 +377,7 @@ def _convert_area_lamp(obj, scene, context, luxcore_scene, gain, importance, lux
]
luxcore_scene.DefineMesh(shape_name, vertices, faces, normals, None, None, None, mesh_transform)

# Note: we append "000" to the luxcore name here as fake material index because the DefineBlenderMesh
# function would do the same, and it is expected by other parts of the code.
obj_prefix = "scene.objects." + luxcore_name + "000" + "."
obj_prefix = "scene.objects." + _get_area_obj_name(luxcore_name) + "."
obj_definitions = {
"material": mat_name,
"shape": shape_name,
Expand All @@ -398,6 +396,12 @@ def _convert_area_lamp(obj, scene, context, luxcore_scene, gain, importance, lux
return props, exported_obj


def _get_area_obj_name(luxcore_name):
# Note: we append "000" to the luxcore name here as fake material index because the DefineBlenderMesh
# function would do the same, and it is expected by other parts of the code.
return luxcore_name + "000"


def _indirect_light_visibility(definitions, lamp_or_world):
definitions.update({
"visibility.indirect.diffuse.enable": lamp_or_world.luxcore.visibility_indirect_diffuse,
Expand Down

0 comments on commit 85bf492

Please sign in to comment.