Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,62 @@
import bpy
from bpy.utils import register_class, unregister_class
from . import scene, object, atlas, image
from . renderer import cycles, luxcorerender, octanerender
from . denoiser import oidn, optix
classes = [
scene.TLM_SceneProperties,
object.TLM_ObjectProperties,
cycles.TLM_CyclesSceneProperties,
luxcorerender.TLM_LuxCoreSceneProperties,
octanerender.TLM_OctanerenderSceneProperties,
oidn.TLM_OIDNEngineProperties,
optix.TLM_OptixEngineProperties,
atlas.TLM_AtlasListItem,
atlas.TLM_UL_AtlasList,
atlas.TLM_PostAtlasListItem,
atlas.TLM_UL_PostAtlasList,
image.TLM_ImageProperties,
scene.TLM_UL_GroupList,
scene.TLM_GroupListItem
]
def register():
for cls in classes:
register_class(cls)
bpy.types.Scene.TLM_SceneProperties = bpy.props.PointerProperty(type=scene.TLM_SceneProperties)
bpy.types.Object.TLM_ObjectProperties = bpy.props.PointerProperty(type=object.TLM_ObjectProperties)
bpy.types.Scene.TLM_EngineProperties = bpy.props.PointerProperty(type=cycles.TLM_CyclesSceneProperties)
bpy.types.Scene.TLM_Engine2Properties = bpy.props.PointerProperty(type=luxcorerender.TLM_LuxCoreSceneProperties)
bpy.types.Scene.TLM_Engine3Properties = bpy.props.PointerProperty(type=octanerender.TLM_OctanerenderSceneProperties)
bpy.types.Scene.TLM_OIDNEngineProperties = bpy.props.PointerProperty(type=oidn.TLM_OIDNEngineProperties)
bpy.types.Scene.TLM_OptixEngineProperties = bpy.props.PointerProperty(type=optix.TLM_OptixEngineProperties)
bpy.types.Scene.TLM_AtlasListItem = bpy.props.IntProperty(name="Index for my_list", default=0)
bpy.types.Scene.TLM_AtlasList = bpy.props.CollectionProperty(type=atlas.TLM_AtlasListItem)
bpy.types.Scene.TLM_PostAtlasListItem = bpy.props.IntProperty(name="Index for my_list", default=0)
bpy.types.Scene.TLM_PostAtlasList = bpy.props.CollectionProperty(type=atlas.TLM_PostAtlasListItem)
bpy.types.Image.TLM_ImageProperties = bpy.props.PointerProperty(type=image.TLM_ImageProperties)
bpy.types.Scene.TLM_GroupListItem = bpy.props.IntProperty(name="Index for my_list", default=0)
bpy.types.Scene.TLM_GroupList = bpy.props.CollectionProperty(type=scene.TLM_GroupListItem)
bpy.types.Material.TLM_ignore = bpy.props.BoolProperty(name="Skip material", description="Ignore material for lightmapped object", default=False)
def unregister():
for cls in classes:
unregister_class(cls)
del bpy.types.Scene.TLM_SceneProperties
del bpy.types.Object.TLM_ObjectProperties
del bpy.types.Scene.TLM_EngineProperties
del bpy.types.Scene.TLM_Engine2Properties
del bpy.types.Scene.TLM_Engine3Properties
del bpy.types.Scene.TLM_OIDNEngineProperties
del bpy.types.Scene.TLM_OptixEngineProperties
del bpy.types.Scene.TLM_AtlasListItem
del bpy.types.Scene.TLM_AtlasList
del bpy.types.Scene.TLM_PostAtlasListItem
del bpy.types.Scene.TLM_PostAtlasList
del bpy.types.Image.TLM_ImageProperties
del bpy.types.Scene.TLM_GroupListItem
del bpy.types.Scene.TLM_GroupList

View File

@ -0,0 +1,166 @@
import bpy
from bpy.props import *
class TLM_PostAtlasListItem(bpy.types.PropertyGroup):
obj: PointerProperty(type=bpy.types.Object, description="The object to bake")
tlm_atlas_lightmap_resolution : EnumProperty(
items = [('32', '32', 'TODO'),
('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO'),
('8192', '8192', 'TODO')],
name = "Atlas Lightmap Resolution",
description="TODO",
default='256')
tlm_atlas_repack_on_cleanup : BoolProperty(
name="Repack on cleanup",
description="Postpacking adjusts the UV's. Toggle to resize back to full scale on cleanup.",
default=True)
tlm_atlas_dilation : BoolProperty(
name="Dilation",
description="Adds a blurred background layer that acts as a dilation map.",
default=False)
tlm_atlas_unwrap_margin : FloatProperty(
name="Unwrap Margin",
default=0.1,
min=0.0,
max=1.0,
subtype='FACTOR')
unwrap_modes = [('Lightmap', 'Lightmap', 'Use Blender Lightmap Pack algorithm'),
('SmartProject', 'Smart Project', 'Use Blender Smart Project algorithm'),
('Copy', 'Copy existing', 'Use the existing UV channel')]
if "blender_xatlas" in bpy.context.preferences.addons.keys():
unwrap_modes.append(('Xatlas', 'Xatlas', 'Use Xatlas addon packing algorithm'))
tlm_atlas_merge_samemat : BoolProperty(
name="Merge materials",
description="Merge objects with same materials.",
default=True)
tlm_postatlas_lightmap_unwrap_mode : EnumProperty(
items = unwrap_modes,
name = "Unwrap Mode",
description="Atlas unwrapping method",
default='SmartProject')
class TLM_UL_PostAtlasList(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
custom_icon = 'OBJECT_DATAMODE'
if self.layout_type in {'DEFAULT', 'COMPACT'}:
#In list object counter
amount = 0
for obj in bpy.context.scene.objects:
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:
if obj.TLM_ObjectProperties.tlm_postpack_object:
if obj.TLM_ObjectProperties.tlm_postatlas_pointer == item.name:
amount = amount + 1
row = layout.row()
row.prop(item, "name", text="", emboss=False, icon=custom_icon)
col = row.column()
col.label(text=item.tlm_atlas_lightmap_resolution)
col = row.column()
col.alignment = 'RIGHT'
col.label(text=str(amount))
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon = custom_icon)
class TLM_AtlasListItem(bpy.types.PropertyGroup):
obj: PointerProperty(type=bpy.types.Object, description="The object to bake")
tlm_atlas_lightmap_resolution : EnumProperty(
items = [('32', '32', 'TODO'),
('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO'),
('8192', '8192', 'TODO')],
name = "Atlas Lightmap Resolution",
description="TODO",
default='256')
tlm_atlas_unwrap_margin : FloatProperty(
name="Unwrap Margin",
default=0.1,
min=0.0,
max=1.0,
subtype='FACTOR')
unwrap_modes = [('Lightmap', 'Lightmap', 'Use Blender Lightmap Pack algorithm'),
('SmartProject', 'Smart Project', 'Use Blender Smart Project algorithm'),
('Copy', 'Copy existing', 'Use the existing UV channel')]
if "blender_xatlas" in bpy.context.preferences.addons.keys():
unwrap_modes.append(('Xatlas', 'Xatlas', 'Use Xatlas addon packing algorithm'))
tlm_atlas_lightmap_unwrap_mode : EnumProperty(
items = unwrap_modes,
name = "Unwrap Mode",
description="Atlas unwrapping method",
default='SmartProject')
tlm_atlas_merge_samemat : BoolProperty(
name="Merge materials",
description="Merge objects with same materials.",
default=True)
tlm_use_uv_packer : BoolProperty(
name="Use UV Packer",
description="UV Packer will be utilized after initial UV mapping for optimized packing.",
default=False)
tlm_uv_packer_padding : FloatProperty(
name="Padding",
default=2.0,
min=0.0,
max=100.0,
subtype='FACTOR')
tlm_uv_packer_packing_engine : EnumProperty(
items = [('OP0', 'Efficient', 'Best compromise for speed and space usage.'),
('OP1', 'High Quality', 'Slowest, but maximum space usage.')],
name = "Packing Engine",
description="Which UV Packer engine to use.",
default='OP0')
class TLM_UL_AtlasList(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
custom_icon = 'OBJECT_DATAMODE'
if self.layout_type in {'DEFAULT', 'COMPACT'}:
amount = 0
for obj in bpy.context.scene.objects:
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_unwrap_mode == "AtlasGroupA":
if obj.TLM_ObjectProperties.tlm_atlas_pointer == item.name:
amount = amount + 1
row = layout.row()
row.prop(item, "name", text="", emboss=False, icon=custom_icon)
col = row.column()
col.label(text=item.tlm_atlas_lightmap_resolution)
col = row.column()
col.alignment = 'RIGHT'
col.label(text=str(amount))
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon = custom_icon)

View File

@ -0,0 +1,4 @@
import bpy
from bpy.props import *
class TLM_IntegratedDenoiseEngineProperties(bpy.types.PropertyGroup):

View File

@ -0,0 +1,40 @@
import bpy, os
from ...utility import utility
from bpy.props import *
class TLM_OIDNEngineProperties(bpy.types.PropertyGroup):
tlm_oidn_path : StringProperty(
name="OIDN Path",
description="The path to the OIDN binaries",
default="",
subtype="FILE_PATH")
tlm_oidn_verbose : BoolProperty(
name="Verbose",
description="TODO")
tlm_oidn_threads : IntProperty(
name="Threads",
default=0,
min=0,
max=64,
description="Amount of threads to use. Set to 0 for auto-detect.")
tlm_oidn_maxmem : IntProperty(
name="Tiling max Memory",
default=0,
min=512,
max=32768,
description="Use tiling for memory conservation. Set to 0 to disable tiling.")
tlm_oidn_affinity : BoolProperty(
name="Set Affinity",
description="TODO")
tlm_oidn_use_albedo : BoolProperty(
name="Use albedo map",
description="TODO")
tlm_oidn_use_normal : BoolProperty(
name="Use normal map",
description="TODO")

View File

@ -0,0 +1,21 @@
import bpy
from bpy.props import *
class TLM_OptixEngineProperties(bpy.types.PropertyGroup):
tlm_optix_path : StringProperty(
name="Optix Path",
description="TODO",
default="",
subtype="FILE_PATH")
tlm_optix_verbose : BoolProperty(
name="Verbose",
description="TODO")
tlm_optix_maxmem : IntProperty(
name="Tiling max Memory",
default=0,
min=512,
max=32768,
description="Use tiling for memory conservation. Set to 0 to disable tiling.")

View File

@ -0,0 +1,4 @@
import bpy
from bpy.props import *
class TLM_FilteringProperties(bpy.types.PropertyGroup):

View File

@ -0,0 +1,26 @@
import bpy
from bpy.props import *
class TLM_ImageProperties(bpy.types.PropertyGroup):
tlm_image_scale_engine : EnumProperty(
items = [('OpenCV', 'OpenCV', 'TODO')],
name = "Scaling engine",
description="TODO",
default='OpenCV')
#('Native', 'Native', 'TODO'),
tlm_image_scale_method : EnumProperty(
items = [('Nearest', 'Nearest', 'TODO'),
('Area', 'Area', 'TODO'),
('Linear', 'Linear', 'TODO'),
('Cubic', 'Cubic', 'TODO'),
('Lanczos', 'Lanczos', 'TODO')],
name = "Scaling method",
description="TODO",
default='Lanczos')
tlm_image_cache_switch : BoolProperty(
name="Cache for quickswitch",
description="Caches scaled images for quick switching",
default=True)

View File

@ -0,0 +1,182 @@
import bpy
from bpy.props import *
class TLM_ObjectProperties(bpy.types.PropertyGroup):
addon_keys = bpy.context.preferences.addons.keys()
tlm_atlas_pointer : StringProperty(
name = "Atlas Group",
description = "",
default = "")
tlm_postatlas_pointer : StringProperty(
name = "Atlas Group",
description = "Atlas Lightmap Group",
default = "")
tlm_uvchannel_pointer : StringProperty(
name = "UV Channel",
description = "Select UV Channel to bake to",
default = "")
tlm_uvchannel_pointer : BoolProperty(
name="Enable Lightmapping",
description="TODO",
default=False)
tlm_mesh_lightmap_use : BoolProperty(
name="Enable Lightmapping",
description="TODO",
default=False)
tlm_material_ignore : BoolProperty(
name="Skip material",
description="Ignore material for lightmapped object",
default=False)
tlm_mesh_lightmap_resolution : EnumProperty(
items = [('32', '32', 'TODO'),
('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO'),
('8192', '8192', 'TODO')],
name = "Lightmap Resolution",
description="TODO",
default='256')
unwrap_modes = [('Lightmap', 'Lightmap', 'TODO'),
('SmartProject', 'Smart Project', 'TODO'),
('AtlasGroupA', 'Atlas Group (Prepack)', 'Attaches the object to a prepack Atlas group. Will overwrite UV map on build.'),
('Copy', 'Copy existing', 'Use the existing UV channel')]
tlm_postpack_object : BoolProperty( #CHECK INSTEAD OF ATLASGROUPB
name="Postpack object",
description="Postpack object into an AtlasGroup",
default=False)
if "blender_xatlas" in addon_keys:
unwrap_modes.append(('Xatlas', 'Xatlas', 'TODO'))
tlm_mesh_lightmap_unwrap_mode : EnumProperty(
items = unwrap_modes,
name = "Unwrap Mode",
description="TODO",
default='SmartProject')
tlm_mesh_unwrap_margin : FloatProperty(
name="Unwrap Margin",
default=0.1,
min=0.0,
max=1.0,
subtype='FACTOR')
tlm_mesh_filter_override : BoolProperty(
name="Override filtering",
description="Override the scene specific filtering",
default=False)
#FILTERING SETTINGS GROUP
tlm_mesh_filtering_engine : EnumProperty(
items = [('OpenCV', 'OpenCV', 'Make use of OpenCV based image filtering (Requires it to be installed first in the preferences panel)'),
('Numpy', 'Numpy', 'Make use of Numpy based image filtering (Integrated)')],
name = "Filtering library",
description="Select which filtering library to use.",
default='Numpy')
#Numpy Filtering options
tlm_mesh_numpy_filtering_mode : EnumProperty(
items = [('Blur', 'Blur', 'Basic blur filtering.')],
name = "Filter",
description="TODO",
default='Blur')
#OpenCV Filtering options
tlm_mesh_filtering_mode : EnumProperty(
items = [('Box', 'Box', 'Basic box blur'),
('Gaussian', 'Gaussian', 'Gaussian blurring'),
('Bilateral', 'Bilateral', 'Edge-aware filtering'),
('Median', 'Median', 'Median blur')],
name = "Filter",
description="TODO",
default='Median')
tlm_mesh_filtering_gaussian_strength : IntProperty(
name="Gaussian Strength",
default=3,
min=1,
max=50)
tlm_mesh_filtering_iterations : IntProperty(
name="Filter Iterations",
default=5,
min=1,
max=50)
tlm_mesh_filtering_box_strength : IntProperty(
name="Box Strength",
default=1,
min=1,
max=50)
tlm_mesh_filtering_bilateral_diameter : IntProperty(
name="Pixel diameter",
default=3,
min=1,
max=50)
tlm_mesh_filtering_bilateral_color_deviation : IntProperty(
name="Color deviation",
default=75,
min=1,
max=100)
tlm_mesh_filtering_bilateral_coordinate_deviation : IntProperty(
name="Color deviation",
default=75,
min=1,
max=100)
tlm_mesh_filtering_median_kernel : IntProperty(
name="Median kernel",
default=3,
min=1,
max=5)
tlm_use_default_channel : BoolProperty(
name="Use default UV channel",
description="Will either use or create the default UV Channel 'UVMap_Lightmap' upon build.",
default=True)
tlm_uv_channel : StringProperty(
name = "UV Channel",
description = "Use any custom UV Channel for the lightmap",
default = "UVMap")
tlm_use_uv_packer : BoolProperty(
name="Use UV Packer",
description="UV Packer will be utilized after initial UV mapping for optimized packing.",
default=False)
tlm_uv_packer_padding : FloatProperty(
name="Padding",
default=2.0,
min=0.0,
max=100.0,
subtype='FACTOR')
tlm_uv_packer_packing_engine : EnumProperty(
items = [('OP0', 'Efficient', 'Best compromise for speed and space usage.'),
('OP1', 'High Quality', 'Slowest, but maximum space usage.')],
name = "Packing Engine",
description="Which UV Packer engine to use.",
default='OP0')
#Padding
#Type
#Rescale
#Pre-rotate

View File

@ -0,0 +1,115 @@
import bpy
from bpy.props import *
class TLM_CyclesSceneProperties(bpy.types.PropertyGroup):
tlm_mode : EnumProperty(
items = [('CPU', 'CPU', 'Use the processor to bake textures'),
('GPU', 'GPU', 'Use the graphics card to bake textures')],
name = "Device",
description="Select whether to use the CPU or the GPU for baking",
default="CPU")
tlm_quality : EnumProperty(
items = [('0', 'Exterior Preview', 'Best for fast exterior previz'),
('1', 'Interior Preview', 'Best for fast interior previz with bounces'),
('2', 'Medium', 'Best for complicated interior preview and final for isometric environments'),
('3', 'High', 'Best used for final baking for 3rd person games'),
('4', 'Production', 'Best for first-person and Archviz'),
('5', 'Custom', 'Uses the cycles sample settings provided the user')],
name = "Quality",
description="Select baking quality",
default="0")
targets = [('texture', 'Image texture', 'Build to image texture')]
if (2, 92, 0) >= bpy.app.version:
targets.append(('vertex', 'Vertex colors', 'Build to vertex colors'))
tlm_target : EnumProperty(
items = targets,
name = "Build Target",
description="Select target to build to",
default="texture")
tlm_resolution_scale : EnumProperty(
items = [('1', '1/1', '1'),
('2', '1/2', '2'),
('4', '1/4', '4'),
('8', '1/8', '8')],
name = "Resolution scale",
description="Select resolution scale",
default="2")
tlm_setting_supersample : EnumProperty(
items = [('none', 'None', 'No supersampling'),
('2x', '2x', 'Double supersampling'),
('4x', '4x', 'Quadruple supersampling')],
name = "Supersampling",
description="Supersampling scale",
default="none")
tlm_bake_mode : EnumProperty(
items = [('Background', 'Background', 'More overhead; allows for network.'),
('Foreground', 'Foreground', 'Direct in-session bake')],
name = "Baking mode",
description="Select bake mode",
default="Foreground")
caching_modes = [('Copy', 'Copy', 'More overhead; allows for network.')]
#caching_modes.append(('Cache', 'Cache', 'Cache in separate blend'),('Node', 'Node restore', 'EXPERIMENTAL! Use with care'))
tlm_caching_mode : EnumProperty(
items = caching_modes,
name = "Caching mode",
description="Select cache mode",
default="Copy")
tlm_directional_mode : EnumProperty(
items = [('None', 'None', 'No directional information'),
('Normal', 'Baked normal', 'Baked normal maps are taken into consideration')],
name = "Directional mode",
description="Select directional mode",
default="None")
tlm_lightmap_savedir : StringProperty(
name="Lightmap Directory",
description="TODO",
default="Lightmaps",
subtype="FILE_PATH")
tlm_dilation_margin : IntProperty(
name="Dilation margin",
default=4,
min=1,
max=64,
subtype='PIXEL')
tlm_exposure_multiplier : FloatProperty(
name="Exposure Multiplier",
default=0,
description="0 to disable. Multiplies GI value")
tlm_metallic_handling_mode : EnumProperty(
items = [('ignore', 'Ignore', 'No directional information'),
('clamp', 'Clamp', 'Clamp to value 0.9'),
('zero', 'Zero', 'Temporarily set to 0 during baking, and reapply after')],
name = "Metallic handling",
description="Set metallic handling mode to prevent black-baking.",
default="ignore")
tlm_lighting_mode : EnumProperty(
items = [('combined', 'Combined', 'Bake combined lighting'),
('combinedao', 'Combined+AO', 'Bake combined lighting with Ambient Occlusion'),
('indirect', 'Indirect', 'Bake indirect lighting'),
('indirectao', 'Indirect+AO', 'Bake indirect lighting with Ambient Occlusion'),
('ao', 'AO', 'Bake only Ambient Occlusion'),
('complete', 'Complete', 'Bake complete map')],
name = "Lighting mode",
description="TODO.",
default="combined")
tlm_premultiply_ao : BoolProperty(
name="Premultiply AO",
description="Ambient Occlusion will be premultiplied together with lightmaps, requiring less textures.",
default=True)

View File

@ -0,0 +1,11 @@
import bpy
from bpy.props import *
class TLM_LuxCoreSceneProperties(bpy.types.PropertyGroup):
#Luxcore specific here
tlm_luxcore_dir : StringProperty(
name="Luxcore Directory",
description="Standalone path to your LuxCoreRender binary.",
default="",
subtype="FILE_PATH")

View File

@ -0,0 +1,10 @@
import bpy
from bpy.props import *
class TLM_OctanerenderSceneProperties(bpy.types.PropertyGroup):
tlm_lightmap_savedir : StringProperty(
name="Lightmap Directory",
description="TODO",
default="Lightmaps",
subtype="FILE_PATH")

View File

@ -0,0 +1,585 @@
import bpy, os
from bpy.props import *
from .. utility import utility
def transfer_load():
load_folder = bpy.context.scene.TLM_SceneProperties.tlm_load_folder
lightmap_folder = os.path.join(os.path.dirname(bpy.data.filepath), bpy.context.scene.TLM_EngineProperties.tlm_lightmap_savedir)
print(load_folder)
print(lightmap_folder)
#transfer_assets(True, load_folder, lightmap_folder)
class TLM_SceneProperties(bpy.types.PropertyGroup):
engines = [('Cycles', 'Cycles', 'Use Cycles for lightmapping')]
#engines.append(('LuxCoreRender', 'LuxCoreRender', 'Use LuxCoreRender for lightmapping'))
#engines.append(('OctaneRender', 'Octane Render', 'Use Octane Render for lightmapping'))
tlm_atlas_pointer : StringProperty(
name = "Atlas Group",
description = "Atlas Lightmap Group",
default = "")
tlm_postatlas_pointer : StringProperty(
name = "Atlas Group",
description = "Atlas Lightmap Group",
default = "")
tlm_lightmap_engine : EnumProperty(
items = engines,
name = "Lightmap Engine",
description="Select which lightmap engine to use.",
default='Cycles')
#SETTINGS GROUP
tlm_setting_clean_option : EnumProperty(
items = [('Clean', 'Full Clean', 'Clean lightmap directory and revert all materials'),
('CleanMarked', 'Clean marked', 'Clean only the objects marked for lightmapping')],
name = "Clean mode",
description="The cleaning mode, either full or partial clean. Be careful that you don't delete lightmaps you don't intend to delete.",
default='Clean')
tlm_setting_keep_cache_files : BoolProperty(
name="Keep cache files",
description="Keep cache files (non-filtered and non-denoised)",
default=True)
tlm_keep_baked_files : BoolProperty(
name="Keep bake files",
description="Keep the baked lightmap files when cleaning",
default=False)
tlm_repartition_on_clean : BoolProperty(
name="Repartition on clean",
description="Repartition material names on clean",
default=False)
tlm_setting_renderer : EnumProperty(
items = [('CPU', 'CPU', 'Bake using the processor'),
('GPU', 'GPU', 'Bake using the graphics card')],
name = "Device",
description="Select whether to use the CPU or the GPU",
default="CPU")
tlm_setting_scale : EnumProperty(
items = [('8', '1/8', '1/8th of set scale'),
('4', '1/4', '1/4th of set scale'),
('2', '1/2', 'Half of set scale'),
('1', '1/1', 'Full scale')],
name = "Lightmap Resolution scale",
description="Lightmap resolution scaling. Adjust for previewing.",
default="1")
tlm_setting_supersample : EnumProperty(
items = [('2x', '2x', 'Double the sampling resolution'),
('4x', '4x', 'Quadruple the sampling resolution')],
name = "Lightmap Supersampling",
description="Supersamples the baked lightmap. Increases bake time",
default="2x")
tlm_setting_savedir : StringProperty(
name="Lightmap Directory",
description="Your baked lightmaps will be stored here.",
default="Lightmaps",
subtype="FILE_PATH")
tlm_setting_exposure_multiplier : FloatProperty(
name="Exposure Multiplier",
default=0,
description="0 to disable. Multiplies GI value")
tlm_alert_on_finish : BoolProperty(
name="Alert on finish",
description="Play a sound when the lightmaps are done.",
default=False)
tlm_setting_apply_scale : BoolProperty(
name="Apply scale",
description="Apply the scale before unwrapping.",
default=True)
tlm_play_sound : BoolProperty(
name="Play sound on finish",
description="Play sound on finish",
default=False)
tlm_compile_statistics : BoolProperty(
name="Compile statistics",
description="Compile time statistics in the lightmap folder.",
default=True)
tlm_apply_on_unwrap : BoolProperty(
name="Apply scale",
description="TODO",
default=False)
tlm_save_preprocess_lightmaps : BoolProperty(
name="Save preprocessed lightmaps",
description="TODO",
default=False)
#DENOISE SETTINGS GROUP
tlm_denoise_use : BoolProperty(
name="Enable denoising",
description="Enable denoising for lightmaps",
default=False)
tlm_denoise_engine : EnumProperty(
items = [('Integrated', 'Integrated', 'Use the Blender native denoiser (Compositor; Slow)'),
('OIDN', 'Intel Denoiser', 'Use Intel denoiser (CPU powered)'),
('Optix', 'Optix Denoiser', 'Use Nvidia Optix denoiser (GPU powered)')],
name = "Denoiser",
description="Select which denoising engine to use.",
default='Integrated')
#FILTERING SETTINGS GROUP
tlm_filtering_use : BoolProperty(
name="Enable denoising",
description="Enable denoising for lightmaps",
default=False)
tlm_filtering_engine : EnumProperty(
items = [('OpenCV', 'OpenCV', 'Make use of OpenCV based image filtering (Requires it to be installed first in the preferences panel)'),
('Shader', 'Shader', 'Make use of GPU offscreen shader to filter')],
name = "Filtering library",
description="Select which filtering library to use.",
default='OpenCV')
#Numpy Filtering options
tlm_numpy_filtering_mode : EnumProperty(
items = [('Blur', 'Blur', 'Basic blur filtering.')],
name = "Filter",
description="TODO",
default='Blur')
#OpenCV Filtering options
tlm_filtering_mode : EnumProperty(
items = [('Box', 'Box', 'Basic box blur'),
('Gaussian', 'Gaussian', 'Gaussian blurring'),
('Bilateral', 'Bilateral', 'Edge-aware filtering'),
('Median', 'Median', 'Median blur')],
name = "Filter",
description="TODO",
default='Median')
tlm_filtering_gaussian_strength : IntProperty(
name="Gaussian Strength",
default=3,
min=1,
max=50)
tlm_filtering_iterations : IntProperty(
name="Filter Iterations",
default=5,
min=1,
max=50)
tlm_filtering_box_strength : IntProperty(
name="Box Strength",
default=1,
min=1,
max=50)
tlm_filtering_bilateral_diameter : IntProperty(
name="Pixel diameter",
default=3,
min=1,
max=50)
tlm_filtering_bilateral_color_deviation : IntProperty(
name="Color deviation",
default=75,
min=1,
max=100)
tlm_filtering_bilateral_coordinate_deviation : IntProperty(
name="Coordinate deviation",
default=75,
min=1,
max=100)
tlm_filtering_median_kernel : IntProperty(
name="Median kernel",
default=3,
min=1,
max=5)
tlm_clamp_hdr : BoolProperty(
name="Enable HDR Clamp",
description="Clamp HDR Value",
default=False)
tlm_clamp_hdr_value : IntProperty(
name="HDR Clamp value",
default=10,
min=0,
max=20)
#Encoding properties
tlm_encoding_use : BoolProperty(
name="Enable encoding",
description="Enable encoding for lightmaps",
default=False)
tlm_encoding_device : EnumProperty(
items = [('CPU', 'CPU', 'Todo'),
('GPU', 'GPU', 'Todo.')],
name = "Encoding Device",
description="TODO",
default='CPU')
encoding_modes_1 = [('RGBM', 'RGBM', '8-bit HDR encoding. Good for compatibility, good for memory but has banding issues.'),
('RGBD', 'RGBD', '8-bit HDR encoding. Similar to RGBM.'),
('HDR', 'HDR', '32-bit HDR encoding. Best quality, but high memory usage and not compatible with all devices.'),
('SDR', 'SDR', '8-bit flat encoding.')]
encoding_modes_2 = [('RGBD', 'RGBD', '8-bit HDR encoding. Similar to RGBM.'),
('LogLuv', 'LogLuv', '8-bit HDR encoding. Different.'),
('HDR', 'HDR', '32-bit HDR encoding. Best quality, but high memory usage and not compatible with all devices.'),
('SDR', 'SDR', '8-bit flat encoding.')]
tlm_encoding_mode_a : EnumProperty(
items = encoding_modes_1,
name = "Encoding Mode",
description="TODO",
default='HDR')
tlm_encoding_mode_b : EnumProperty(
items = encoding_modes_2,
name = "Encoding Mode",
description="RGBE 32-bit Radiance HDR File",
default='HDR')
tlm_encoding_range : IntProperty(
name="Encoding range",
description="Higher gives a larger HDR range, but also gives more banding.",
default=6,
min=1,
max=255)
tlm_decoder_setup : BoolProperty(
name="Use decoder",
description="Apply a node for decoding.",
default=False)
tlm_split_premultiplied : BoolProperty(
name="Split for premultiplied",
description="Some game engines doesn't support non-premultiplied files. This splits the alpha channel to a separate file.",
default=False)
tlm_encoding_colorspace : EnumProperty(
items = [('XYZ', 'XYZ', 'TODO'),
('sRGB', 'sRGB', 'TODO'),
('NonColor', 'Non-Color', 'TODO'),
('ACES', 'Linear ACES', 'TODO'),
('Linear', 'Linear', 'TODO'),
('FilmicLog', 'Filmic Log', 'TODO')],
name = "Color Space",
description="TODO",
default='Linear')
tlm_compression : IntProperty(
name="PNG Compression",
description="0 = No compression. 100 = Maximum compression.",
default=0,
min=0,
max=100)
tlm_format : EnumProperty(
items = [('RGBE', 'HDR', '32-bit RGBE encoded .hdr files. No compression available.'),
('EXR', 'EXR', '32-bit OpenEXR format.')],
name = "Format",
description="Select default 32-bit format",
default='RGBE')
tlm_override_object_settings : BoolProperty(
name="Override settings",
description="TODO",
default=False)
tlm_mesh_lightmap_resolution : EnumProperty(
items = [('32', '32', 'TODO'),
('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO'),
('8192', '8192', 'TODO')],
name = "Lightmap Resolution",
description="TODO",
default='256')
tlm_mesh_lightmap_unwrap_mode : EnumProperty(
items = [('Lightmap', 'Lightmap', 'TODO'),
('SmartProject', 'Smart Project', 'TODO'),
('AtlasGroupA', 'Atlas Group (Prepack)', 'Attaches the object to a prepack Atlas group. Will overwrite UV map on build.'),
('Xatlas', 'Xatlas', 'TODO')],
name = "Unwrap Mode",
description="TODO",
default='SmartProject')
tlm_postpack_object : BoolProperty( #CHECK INSTEAD OF ATLASGROUPB
name="Postpack object",
description="Postpack object into an AtlasGroup",
default=False)
tlm_mesh_unwrap_margin : FloatProperty(
name="Unwrap Margin",
default=0.1,
min=0.0,
max=1.0,
subtype='FACTOR')
tlm_headless : BoolProperty(
name="Don't apply materials",
description="Headless; Do not apply baked materials on finish.",
default=False)
tlm_atlas_mode : EnumProperty(
items = [('Prepack', 'Pre-packing', 'Todo.'),
('Postpack', 'Post-packing', 'Todo.')],
name = "Atlas mode",
description="TODO",
default='Prepack')
tlm_alert_sound : EnumProperty(
items = [('dash', 'Dash', 'Dash alert'),
('noot', 'Noot', 'Noot alert'),
('gentle', 'Gentle', 'Gentle alert'),
('pingping', 'Ping', 'Ping alert')],
name = "Alert sound",
description="Alert sound when lightmap building finished.",
default="gentle")
tlm_metallic_clamp : EnumProperty(
items = [('ignore', 'Ignore', 'Ignore clamping'),
('skip', 'Skip', 'Skip baking metallic materials'),
('zero', 'Zero', 'Set zero'),
('limit', 'Limit', 'Clamp to 0.9')],
name = "Metallic clamping",
description="TODO.",
default="ignore")
tlm_texture_interpolation : EnumProperty(
items = [('Smart', 'Smart', 'Bicubic when magnifying.'),
('Cubic', 'Cubic', 'Cubic interpolation'),
('Closest', 'Closest', 'No interpolation'),
('Linear', 'Linear', 'Linear')],
name = "Texture interpolation",
description="Texture interpolation.",
default="Linear")
tlm_texture_extrapolation : EnumProperty(
items = [('REPEAT', 'Repeat', 'Repeat in both direction.'),
('EXTEND', 'Extend', 'Extend by repeating edge pixels.'),
('CLIP', 'Clip', 'Clip to image size')],
name = "Texture extrapolation",
description="Texture extrapolation.",
default="EXTEND")
tlm_verbose : BoolProperty(
name="Verbose",
description="Verbose console output",
default=False)
tlm_compile_statistics : BoolProperty(
name="Compile statistics",
description="Compile lightbuild statistics",
default=False)
tlm_override_bg_color : BoolProperty(
name="Override background",
description="Override background color, black by default.",
default=False)
tlm_override_color : FloatVectorProperty(name="Color",
description="Background color for baked maps",
subtype='COLOR',
default=[0.5,0.5,0.5])
tlm_reset_uv : BoolProperty(
name="Remove Lightmap UV",
description="Remove existing UV maps for lightmaps.",
default=False)
tlm_apply_modifiers : BoolProperty(
name="Apply modifiers",
description="Apply all modifiers to objects.",
default=True)
tlm_batch_mode : BoolProperty(
name="Batch mode",
description="Batch collections.",
default=False)
tlm_network_render : BoolProperty(
name="Enable network rendering",
description="Enable network rendering (Unstable).",
default=False)
tlm_network_paths : PointerProperty(
name="Network file",
description="Network instruction file",
type=bpy.types.Text)
tlm_network_dir : StringProperty(
name="Network directory",
description="Use a path that is accessible to all your network render devices.",
default="",
subtype="FILE_PATH")
tlm_cmft_path : StringProperty(
name="CMFT Path",
description="The path to the CMFT binaries",
default="",
subtype="FILE_PATH")
tlm_create_spherical : BoolProperty(
name="Create spherical texture",
description="Merge cubemap to a 360 spherical texture.",
default=False)
tlm_write_sh : BoolProperty(
name="Calculate SH coefficients",
description="Calculates spherical harmonics coefficients to a file.",
default=False)
tlm_write_radiance : BoolProperty(
name="Write radiance images",
description="Writes out the radiance images.",
default=False)
tlm_invert_direction : BoolProperty(
name="Invert direction",
description="Inverts the direction.",
default=False)
tlm_environment_probe_resolution : EnumProperty(
items = [('32', '32', 'TODO'),
('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO'),
('8192', '8192', 'TODO')],
name = "Probe Resolution",
description="TODO",
default='256')
tlm_environment_probe_engine : EnumProperty(
items = [('BLENDER_EEVEE', 'Eevee', 'TODO'),
('CYCLES', 'Cycles', 'TODO')],
name = "Probe Render Engine",
description="TODO",
default='BLENDER_EEVEE')
tlm_load_folder : StringProperty(
name="Load Folder",
description="Load existing lightmaps from folder",
subtype="DIR_PATH")
tlm_load_atlas : BoolProperty(
name="Load lightmaps based on atlas sets",
description="Use the current Atlas list.",
default=False)
tlm_utility_set : EnumProperty(
items = [('Scene', 'Scene', 'Set for all objects in the scene.'),
('Selection', 'Selection', 'Set for selected objects.'),
('Enabled', 'Enabled', 'Set for objects that has been enabled for lightmapping.')],
name = "Set",
description="Utility selection set",
default='Scene')
tlm_resolution_weight : EnumProperty(
items = [('Single', 'Single', 'Set a single resolution for all objects.'),
('Dimension', 'Dimension', 'Distribute resolutions based on object dimensions.'),
('Surface', 'Surface', 'Distribute resolutions based on mesh surface area.'),
('Volume', 'Volume', 'Distribute resolutions based on mesh volume.')],
name = "Resolution weight",
description="Method for setting resolution value",
default='Single')
#Todo add vertex color option
tlm_resolution_min : EnumProperty(
items = [('32', '32', 'TODO'),
('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO')],
name = "Minimum resolution",
description="Minimum distributed resolution",
default='32')
tlm_resolution_max : EnumProperty(
items = [('64', '64', 'TODO'),
('128', '128', 'TODO'),
('256', '256', 'TODO'),
('512', '512', 'TODO'),
('1024', '1024', 'TODO'),
('2048', '2048', 'TODO'),
('4096', '4096', 'TODO')],
name = "Maximum resolution",
description="Maximum distributed resolution",
default='256')
tlm_remove_met_spec_link : BoolProperty(
name="Remove image link",
description="Removes the connected node on metallic or specularity set disable",
default=False)
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'),
('LoadLightmaps', 'Load Lightmaps', 'Options for loading pre-built lightmaps.'),
('NetworkRender', 'Network Rendering', 'Distribute lightmap building across multiple machines.'),
('MaterialAdjustment', 'Material Adjustment', 'Allows adjustment of multiple materials at once.'),
('TexelDensity', 'Texel Density', 'Allows setting texel densities of the UV.'),
('GLTFUtil', 'GLTF Utilities', 'GLTF related material utilities.')],
name = "Utility Context",
description="Set Utility Context",
default='SetBatching')
tlm_addon_uimode : EnumProperty(
items = [('Simple', 'Simple', 'TODO'),
('Advanced', 'Advanced', 'TODO')],
name = "UI Mode",
description="TODO",
default='Simple')
class TLM_GroupListItem(bpy.types.PropertyGroup):
obj: PointerProperty(type=bpy.types.Object, description="The object to bake")
class TLM_UL_GroupList(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
custom_icon = 'OBJECT_DATAMODE'
if self.layout_type in {'DEFAULT', 'COMPACT'}:
amount = 0
for obj in bpy.context.scene.objects:
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_unwrap_mode == "AtlasGroupA":
if obj.TLM_ObjectProperties.tlm_atlas_pointer == item.name:
amount = amount + 1
row = layout.row()
row.prop(item, "name", text="", emboss=False, icon=custom_icon)
col = row.column()
col.label(text=item.tlm_atlas_lightmap_resolution)
col = row.column()
col.alignment = 'RIGHT'
col.label(text=str(amount))
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon = custom_icon)