Skip to content

Commit

Permalink
Add adjust exposure option
Browse files Browse the repository at this point in the history
  • Loading branch information
Naxela committed May 31, 2022
1 parent 71956fe commit 5eb694f
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 4 deletions.
3 changes: 2 additions & 1 deletion addon/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
imagetools.TLM_ImageUpscale,
imagetools.TLM_ImageDownscale,
tlm.TLM_AddGLTFNode,
tlm.TLM_ShiftMultiplyLinks
tlm.TLM_ShiftMultiplyLinks,
tlm.TLM_AdjustExpore

]

Expand Down
71 changes: 71 additions & 0 deletions addon/operators/tlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,77 @@ def execute(self, context):

return{'FINISHED'}

class TLM_AdjustExpore(bpy.types.Operator):
bl_idname = "tlm.adjust_exposure"
bl_label = "Adjust Exposure"
bl_description = "Value override in found exposure nodes"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):

if bpy.context.scene.TLM_SceneProperties.tlm_utility_set == "Scene":
for obj in bpy.context.scene.objects:
if obj.type == "MESH":

for slots in obj.material_slots:

mat = slots.material

nodetree = mat.node_tree

if nodetree:

for node in nodetree.nodes:

if node.name == "Lightmap_Exposure":

print(node.name)

node.inputs[1].default_value = bpy.context.scene.TLM_SceneProperties.tlm_adjust_exposure

elif bpy.context.scene.TLM_SceneProperties.tlm_utility_set == "Selection":
for obj in bpy.context.selected_objects:
if obj.type == "MESH":

for slots in obj.material_slots:

mat = slots.material

nodetree = mat.node_tree

if nodetree:

for node in nodetree.nodes:

if node.name == "Lightmap_Exposure":

print(node.name)

node.inputs[1].default_value = bpy.context.scene.TLM_SceneProperties.tlm_adjust_exposure

else: #Enabled
for obj in bpy.context.scene.objects:
if obj.type == "MESH":
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:

for slots in obj.material_slots:

mat = slots.material

nodetree = mat.node_tree

if nodetree:

for node in nodetree.nodes:

if node.name == "Lightmap_Exposure":

print(node.name)

node.inputs[1].default_value = bpy.context.scene.TLM_SceneProperties.tlm_adjust_exposure

return{'FINISHED'}

class TLM_PostAtlasSpecialsMenu(bpy.types.Menu):
bl_label = "Lightmap"
bl_idname = "TLM_MT_PostAtlasListSpecials"
Expand Down
4 changes: 4 additions & 0 deletions addon/panels/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ def draw(self, context):
row = layout.row(align=True)
row.prop(sceneProperties, "tlm_isolate_lightmap_uv")
row = layout.row(align=True)
row.operator("tlm.adjust_exposure")
row = layout.row(align=True)
row.prop(sceneProperties, "tlm_adjust_exposure")
row = layout.row(align=True)

elif sceneProperties.tlm_utility_context == "NetworkRender":

Expand Down
5 changes: 5 additions & 0 deletions addon/properties/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ class TLM_SceneProperties(bpy.types.PropertyGroup):
description="Deletes other UV channels than the lightmap channel",
default=False)

tlm_adjust_exposure : FloatProperty(
name="Adjusted exposure",
default=0,
description="Value override in found exposure nodes")

tlm_utility_context : EnumProperty(
items = [('SetBatching', 'Set Batching', 'Set batching options. Allows to set lightmap options for multiple objects.'),
('EnvironmentProbes', 'Environment Probes', 'Options for rendering environment probes. Cubemaps and panoramic HDRs for external engines'),
Expand Down
2 changes: 1 addition & 1 deletion addon/utility/denoiser/oidn.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def check_binary(self):

if oidnPath != "":

file = os.path.basename(os.path.realpath(oidnPath))
file = oidnPath
filename, file_extension = os.path.splitext(file)


Expand Down
2 changes: 1 addition & 1 deletion addon/utility/denoiser/optix.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def check_binary(self):

if optixPath != "":

file = os.path.basename(os.path.realpath(optixPath))
file = optixPath
filename, file_extension = os.path.splitext(file)

if(file_extension == ".exe"):
Expand Down
2 changes: 1 addition & 1 deletion addon/utility/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def Unwrap_Lightmap_Group_Xatlas_2_headless_call(obj):

#get the path to xatlas
#file_path = os.path.dirname(os.path.abspath(__file__))
scriptsDir = bpy.utils.user_resource('SCRIPTS', "addons")
scriptsDir = bpy.utils.user_resource('SCRIPTS', path="addons")
file_path = os.path.join(scriptsDir, "blender_xatlas")
if platform.system() == "Windows":
xatlas_path = os.path.join(file_path, "xatlas", "xatlas-blender.exe")
Expand Down

0 comments on commit 5eb694f

Please sign in to comment.