Update to 0.3.2.0
This commit is contained in:
parent
495d485f39
commit
607f4e7b33
|
@ -1 +1 @@
|
|||
__all__ = ('Operators', 'Panels', 'Properties', 'Preferences', 'Utility', 'Keymap')
|
||||
__all__ = ('Operators', 'Properties', 'Preferences', 'Utility', 'Keymap')
|
BIN
blender/arm/lightmapper/assets/dash.ogg
Normal file
BIN
blender/arm/lightmapper/assets/dash.ogg
Normal file
Binary file not shown.
BIN
blender/arm/lightmapper/assets/gentle.ogg
Normal file
BIN
blender/arm/lightmapper/assets/gentle.ogg
Normal file
Binary file not shown.
BIN
blender/arm/lightmapper/assets/noot.ogg
Normal file
BIN
blender/arm/lightmapper/assets/noot.ogg
Normal file
Binary file not shown.
BIN
blender/arm/lightmapper/assets/pingping.ogg
Normal file
BIN
blender/arm/lightmapper/assets/pingping.ogg
Normal file
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
import bpy, os
|
||||
from bpy.utils import register_class, unregister_class
|
||||
from . import scene, object, light, world
|
||||
|
||||
classes = [
|
||||
scene.TLM_PT_Panel,
|
||||
scene.TLM_PT_Settings,
|
||||
scene.TLM_PT_Denoise,
|
||||
scene.TLM_PT_Filtering,
|
||||
scene.TLM_PT_Encoding,
|
||||
scene.TLM_PT_Selection,
|
||||
scene.TLM_PT_Additional,
|
||||
object.TLM_PT_ObjectMenu,
|
||||
light.TLM_PT_LightMenu,
|
||||
world.TLM_PT_WorldMenu
|
||||
]
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in classes:
|
||||
unregister_class(cls)
|
|
@ -1,17 +0,0 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Menu, Panel
|
||||
|
||||
class TLM_PT_LightMenu(bpy.types.Panel):
|
||||
bl_label = "The Lightmapper"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "light"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
obj = bpy.context.object
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
|
@ -1,59 +0,0 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Menu, Panel
|
||||
|
||||
class TLM_PT_ObjectMenu(bpy.types.Panel):
|
||||
bl_label = "The Lightmapper"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "object"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
obj = bpy.context.object
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
if obj.type == "MESH":
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_lightmap_use")
|
||||
|
||||
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:
|
||||
|
||||
row = layout.row()
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_lightmap_resolution")
|
||||
row = layout.row()
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_lightmap_unwrap_mode")
|
||||
row = layout.row()
|
||||
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_unwrap_mode == "AtlasGroup":
|
||||
pass
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_unwrap_margin")
|
||||
row = layout.row()
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filter_override")
|
||||
row = layout.row()
|
||||
if obj.TLM_ObjectProperties.tlm_mesh_filter_override:
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_mode")
|
||||
row = layout.row(align=True)
|
||||
if obj.TLM_ObjectProperties.tlm_mesh_filtering_mode == "Gaussian":
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_gaussian_strength")
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_iterations")
|
||||
elif obj.TLM_ObjectProperties.tlm_mesh_filtering_mode == "Box":
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_box_strength")
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_iterations")
|
||||
elif obj.TLM_ObjectProperties.tlm_mesh_filtering_mode == "Bilateral":
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_bilateral_diameter")
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_bilateral_color_deviation")
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_bilateral_coordinate_deviation")
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_iterations")
|
||||
else:
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_median_kernel", expand=True)
|
||||
row = layout.row(align=True)
|
||||
row.prop(obj.TLM_ObjectProperties, "tlm_mesh_filtering_iterations")
|
|
@ -1,322 +0,0 @@
|
|||
import bpy, importlib
|
||||
from bpy.props import *
|
||||
from bpy.types import Menu, Panel
|
||||
from .. utility import icon
|
||||
from .. properties.denoiser import oidn, optix
|
||||
|
||||
class TLM_PT_Panel(bpy.types.Panel):
|
||||
bl_label = "The Lightmapper"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
|
||||
class TLM_PT_Settings(bpy.types.Panel):
|
||||
bl_label = "Settings"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_parent_id = "TLM_PT_Panel"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
|
||||
row = layout.row(align=True)
|
||||
|
||||
#We list LuxCoreRender as available, by default we assume Cycles exists
|
||||
row.prop(sceneProperties, "tlm_lightmap_engine")
|
||||
|
||||
if sceneProperties.tlm_lightmap_engine == "Cycles":
|
||||
|
||||
#CYCLES SETTINGS HERE
|
||||
engineProperties = scene.TLM_EngineProperties
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(text="General Settings")
|
||||
row = layout.row(align=True)
|
||||
row.operator("tlm.build_lightmaps")
|
||||
row = layout.row(align=True)
|
||||
row.operator("tlm.clean_lightmaps")
|
||||
row = layout.row(align=True)
|
||||
row.operator("tlm.explore_lightmaps")
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_apply_on_unwrap")
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_headless")
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_alert_on_finish")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(text="Cycles Settings")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_mode")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_quality")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_resolution_scale")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_bake_mode")
|
||||
|
||||
if scene.TLM_EngineProperties.tlm_bake_mode == "Background":
|
||||
row = layout.row(align=True)
|
||||
row.label(text="Warning! Background mode is currently unstable", icon_value=2)
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_caching_mode")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_directional_mode")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_lightmap_savedir")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_dilation_margin")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_exposure_multiplier")
|
||||
row = layout.row(align=True)
|
||||
row.prop(engineProperties, "tlm_setting_supersample")
|
||||
|
||||
elif sceneProperties.tlm_lightmap_engine == "LuxCoreRender":
|
||||
|
||||
#LUXCORE SETTINGS HERE
|
||||
luxcore_available = False
|
||||
|
||||
#Look for Luxcorerender in the renderengine classes
|
||||
for engine in bpy.types.RenderEngine.__subclasses__():
|
||||
if engine.bl_idname == "LUXCORE":
|
||||
luxcore_available = True
|
||||
break
|
||||
|
||||
row = layout.row(align=True)
|
||||
if not luxcore_available:
|
||||
row.label(text="Please install BlendLuxCore.")
|
||||
else:
|
||||
row.label(text="LuxCoreRender not yet available.")
|
||||
|
||||
elif sceneProperties.tlm_lightmap_engine == "OctaneRender":
|
||||
|
||||
#LUXCORE SETTINGS HERE
|
||||
octane_available = False
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(text="Octane Render not yet available.")
|
||||
|
||||
class TLM_PT_Denoise(bpy.types.Panel):
|
||||
bl_label = "Denoise"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_parent_id = "TLM_PT_Panel"
|
||||
|
||||
def draw_header(self, context):
|
||||
scene = context.scene
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
self.layout.prop(sceneProperties, "tlm_denoise_use", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
layout.active = sceneProperties.tlm_denoise_use
|
||||
|
||||
row = layout.row(align=True)
|
||||
|
||||
#row.prop(sceneProperties, "tlm_denoiser", expand=True)
|
||||
#row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_denoise_engine", expand=True)
|
||||
row = layout.row(align=True)
|
||||
|
||||
if sceneProperties.tlm_denoise_engine == "Integrated":
|
||||
row.label(text="No options for Integrated.")
|
||||
elif sceneProperties.tlm_denoise_engine == "OIDN":
|
||||
denoiseProperties = scene.TLM_OIDNEngineProperties
|
||||
row.prop(denoiseProperties, "tlm_oidn_path")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_oidn_verbose")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_oidn_threads")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_oidn_maxmem")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_oidn_affinity")
|
||||
# row = layout.row(align=True)
|
||||
# row.prop(denoiseProperties, "tlm_denoise_ao")
|
||||
elif sceneProperties.tlm_denoise_engine == "Optix":
|
||||
denoiseProperties = scene.TLM_OptixEngineProperties
|
||||
row.prop(denoiseProperties, "tlm_optix_path")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_optix_verbose")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_optix_maxmem")
|
||||
row = layout.row(align=True)
|
||||
row.prop(denoiseProperties, "tlm_denoise_ao")
|
||||
|
||||
class TLM_PT_Filtering(bpy.types.Panel):
|
||||
bl_label = "Filtering"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_parent_id = "TLM_PT_Panel"
|
||||
|
||||
def draw_header(self, context):
|
||||
scene = context.scene
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
self.layout.prop(sceneProperties, "tlm_filtering_use", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
layout.active = sceneProperties.tlm_filtering_use
|
||||
#row = layout.row(align=True)
|
||||
#row.label(text="TODO MAKE CHECK")
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_filtering_engine", expand=True)
|
||||
row = layout.row(align=True)
|
||||
|
||||
if sceneProperties.tlm_filtering_engine == "OpenCV":
|
||||
|
||||
cv2 = importlib.util.find_spec("cv2")
|
||||
|
||||
if cv2 is None:
|
||||
row = layout.row(align=True)
|
||||
row.label(text="OpenCV is not installed. Install it through preferences.")
|
||||
else:
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_mode")
|
||||
row = layout.row(align=True)
|
||||
if scene.TLM_SceneProperties.tlm_filtering_mode == "Gaussian":
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_gaussian_strength")
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_iterations")
|
||||
elif scene.TLM_SceneProperties.tlm_filtering_mode == "Box":
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_box_strength")
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_iterations")
|
||||
|
||||
elif scene.TLM_SceneProperties.tlm_filtering_mode == "Bilateral":
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_bilateral_diameter")
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_bilateral_color_deviation")
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_bilateral_coordinate_deviation")
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_iterations")
|
||||
else:
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_median_kernel", expand=True)
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_filtering_iterations")
|
||||
else:
|
||||
row = layout.row(align=True)
|
||||
row.prop(scene.TLM_SceneProperties, "tlm_numpy_filtering_mode")
|
||||
|
||||
|
||||
class TLM_PT_Encoding(bpy.types.Panel):
|
||||
bl_label = "Encoding"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_parent_id = "TLM_PT_Panel"
|
||||
|
||||
def draw_header(self, context):
|
||||
scene = context.scene
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
self.layout.prop(sceneProperties, "tlm_encoding_use", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
layout.active = sceneProperties.tlm_encoding_use
|
||||
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_encoding_mode", expand=True)
|
||||
if sceneProperties.tlm_encoding_mode == "RGBM" or sceneProperties.tlm_encoding_mode == "RGBD":
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_encoding_range")
|
||||
if sceneProperties.tlm_encoding_mode == "LogLuv":
|
||||
pass
|
||||
if sceneProperties.tlm_encoding_mode == "HDR":
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_format")
|
||||
|
||||
class TLM_PT_Selection(bpy.types.Panel):
|
||||
bl_label = "Selection"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_parent_id = "TLM_PT_Panel"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
sceneProperties = scene.TLM_SceneProperties
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("tlm.enable_selection")
|
||||
row = layout.row(align=True)
|
||||
row.operator("tlm.disable_selection")
|
||||
row = layout.row(align=True)
|
||||
row.prop(sceneProperties, "tlm_override_object_settings")
|
||||
|
||||
if sceneProperties.tlm_override_object_settings:
|
||||
|
||||
row = layout.row(align=True)
|
||||
row = layout.row()
|
||||
row.prop(sceneProperties, "tlm_mesh_lightmap_unwrap_mode")
|
||||
row = layout.row()
|
||||
|
||||
if sceneProperties.tlm_mesh_lightmap_unwrap_mode == "AtlasGroup":
|
||||
|
||||
if scene.TLM_AtlasList_index >= 0 and len(scene.TLM_AtlasList) > 0:
|
||||
row = layout.row()
|
||||
item = scene.TLM_AtlasList[scene.TLM_AtlasList_index]
|
||||
row.prop_search(sceneProperties, "tlm_atlas_pointer", scene, "TLM_AtlasList", text='Atlas Group')
|
||||
else:
|
||||
row = layout.label(text="Add Atlas Groups from the scene lightmapping settings.")
|
||||
|
||||
else:
|
||||
|
||||
row.prop(sceneProperties, "tlm_mesh_lightmap_resolution")
|
||||
row = layout.row()
|
||||
row.prop(sceneProperties, "tlm_mesh_unwrap_margin")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("tlm.remove_uv_selection")
|
||||
row = layout.row(align=True)
|
||||
|
||||
class TLM_PT_Additional(bpy.types.Panel):
|
||||
bl_label = "Additional"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_parent_id = "TLM_PT_Panel"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
sceneProperties = scene.TLM_SceneProperties
|
|
@ -1,17 +0,0 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Menu, Panel
|
||||
|
||||
class TLM_PT_WorldMenu(bpy.types.Panel):
|
||||
bl_label = "The Lightmapper"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "world"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
obj = bpy.context.object
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
|
@ -108,10 +108,10 @@ class TLM_SceneProperties(bpy.types.PropertyGroup):
|
|||
|
||||
tlm_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)')],
|
||||
('Shader', 'Shader', 'Make use of GPU offscreen shader to filter')],
|
||||
name = "Filtering library",
|
||||
description="Select which filtering library to use.",
|
||||
default='Numpy')
|
||||
default='OpenCV')
|
||||
|
||||
#Numpy Filtering options
|
||||
tlm_numpy_filtering_mode : EnumProperty(
|
||||
|
@ -261,4 +261,13 @@ class TLM_SceneProperties(bpy.types.PropertyGroup):
|
|||
tlm_headless : BoolProperty(
|
||||
name="Don't apply materials",
|
||||
description="Headless; Do not apply baked materials on finish.",
|
||||
default=False)
|
||||
default=False)
|
||||
|
||||
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")
|
|
@ -1,7 +1,7 @@
|
|||
import bpy, os, importlib, subprocess, sys, threading, platform, aud
|
||||
from . import encoding
|
||||
from . cycles import lightmap, prepare, nodes, cache
|
||||
from . denoiser import integrated, oidn
|
||||
from . denoiser import integrated, oidn, optix
|
||||
from . filtering import opencv
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
|
@ -56,6 +56,8 @@ def prepare_build(self=0, background_mode=False):
|
|||
self.report({'INFO'}, "Error:Filtering - OpenCV not installed")
|
||||
return{'FINISHED'}
|
||||
|
||||
setMode()
|
||||
|
||||
dirpath = os.path.join(os.path.dirname(bpy.data.filepath), bpy.context.scene.TLM_EngineProperties.tlm_lightmap_savedir)
|
||||
if not os.path.isdir(dirpath):
|
||||
os.mkdir(dirpath)
|
||||
|
@ -234,7 +236,24 @@ def begin_build():
|
|||
del denoiser
|
||||
|
||||
else:
|
||||
pass
|
||||
|
||||
baked_image_array = []
|
||||
|
||||
dirfiles = [f for f in listdir(dirpath) if isfile(join(dirpath, f))]
|
||||
|
||||
for file in dirfiles:
|
||||
if file.endswith("_baked.hdr"):
|
||||
baked_image_array.append(file)
|
||||
|
||||
optixProperties = scene.TLM_OptixEngineProperties
|
||||
|
||||
denoiser = optix.TLM_Optix_Denoise(optixProperties, baked_image_array, dirpath)
|
||||
|
||||
denoiser.denoise()
|
||||
|
||||
denoiser.clean()
|
||||
|
||||
del denoiser
|
||||
|
||||
#Filtering
|
||||
if sceneProperties.tlm_filtering_use:
|
||||
|
@ -444,13 +463,23 @@ def manage_build(background_pass=False):
|
|||
|
||||
if scene.TLM_SceneProperties.tlm_alert_on_finish:
|
||||
|
||||
alertSelect = scene.TLM_SceneProperties.tlm_alert_sound
|
||||
|
||||
if alertSelect == "dash":
|
||||
soundfile = "dash.ogg"
|
||||
elif alertSelect == "pingping":
|
||||
soundfile = "pingping.ogg"
|
||||
elif alertSelect == "gentle":
|
||||
soundfile = "gentle.ogg"
|
||||
else:
|
||||
soundfile = "noot.ogg"
|
||||
|
||||
scriptDir = os.path.dirname(os.path.realpath(__file__))
|
||||
sound_path = os.path.abspath(os.path.join(scriptDir, '..', 'assets/sound.ogg'))
|
||||
sound_path = os.path.abspath(os.path.join(scriptDir, '..', 'assets/'+soundfile))
|
||||
|
||||
device = aud.Device()
|
||||
sound = aud.Sound.file(sound_path)
|
||||
device.play(sound)
|
||||
print("ALERT!")
|
||||
|
||||
def reset_settings(prev_settings):
|
||||
scene = bpy.context.scene
|
||||
|
@ -468,6 +497,8 @@ def reset_settings(prev_settings):
|
|||
cycles.device = prev_settings[9]
|
||||
scene.render.engine = prev_settings[10]
|
||||
bpy.context.view_layer.objects.active = prev_settings[11]
|
||||
scene.render.resolution_x = prev_settings[13][0]
|
||||
scene.render.resolution_y = prev_settings[13][1]
|
||||
|
||||
#for obj in prev_settings[12]:
|
||||
# obj.select_set(True)
|
||||
|
@ -550,15 +581,6 @@ def check_denoiser():
|
|||
else:
|
||||
return 0
|
||||
|
||||
# if scene.TLM_SceneProperties.tlm_denoise_use:
|
||||
# if scene.TLM_SceneProperties.tlm_oidn_path == "":
|
||||
# print("NO DENOISE PATH")
|
||||
# return False
|
||||
# else:
|
||||
# return True
|
||||
# else:
|
||||
# return True
|
||||
|
||||
def check_materials():
|
||||
for obj in bpy.data.objects:
|
||||
if obj.type == "MESH":
|
||||
|
@ -582,4 +604,9 @@ def sec_to_hours(seconds):
|
|||
b=str((seconds%3600)//60)
|
||||
c=str((seconds%3600)%60)
|
||||
d=["{} hours {} mins {} seconds".format(a, b, c)]
|
||||
return d
|
||||
return d
|
||||
|
||||
def setMode():
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
#TODO Make some checks that returns to previous selection
|
|
@ -19,11 +19,13 @@ def backup_material_rename(obj):
|
|||
if "TLM_PrevMatArray" in obj:
|
||||
print("Has PrevMat B")
|
||||
for slot in obj.material_slots:
|
||||
if slot.material.name.endswith("_Original"):
|
||||
newname = slot.material.name[1:-9]
|
||||
if newname in bpy.data.materials:
|
||||
bpy.data.materials.remove(bpy.data.materials[newname])
|
||||
slot.material.name = newname
|
||||
|
||||
if slot.material is not None:
|
||||
if slot.material.name.endswith("_Original"):
|
||||
newname = slot.material.name[1:-9]
|
||||
if newname in bpy.data.materials:
|
||||
bpy.data.materials.remove(bpy.data.materials[newname])
|
||||
slot.material.name = newname
|
||||
|
||||
del obj["TLM_PrevMatArray"]
|
||||
|
||||
|
@ -45,30 +47,9 @@ def backup_material_restore(obj):
|
|||
except IndexError:
|
||||
originalMaterial = ""
|
||||
|
||||
slot.material.user_clear()
|
||||
if slot.material is not None:
|
||||
slot.material.user_clear()
|
||||
|
||||
if "." + originalMaterial + "_Original" in bpy.data.materials:
|
||||
slot.material = bpy.data.materials["." + originalMaterial + "_Original"]
|
||||
slot.material.use_fake_user = False
|
||||
|
||||
|
||||
#slot.material =
|
||||
|
||||
#Remove material after changin
|
||||
#We only rename after every change is complete
|
||||
|
||||
#if "." + material.name + "_Original" in bpy.data.materials:
|
||||
|
||||
# material = slot.material
|
||||
# if "." + material.name + "_Original" in bpy.data.materials:
|
||||
# original = bpy.data.materials["." + material.name + "_Original"]
|
||||
# slot.material = original
|
||||
# material.name = material.name
|
||||
# original.name = original.name[1:-9]
|
||||
# original.use_fake_user = False
|
||||
# material.user_clear()
|
||||
# bpy.data.materials.remove(material)
|
||||
# #Reset number
|
||||
# else:
|
||||
# pass
|
||||
#Check if material has nodes with lightmap prefix
|
||||
if "." + originalMaterial + "_Original" in bpy.data.materials:
|
||||
slot.material = bpy.data.materials["." + originalMaterial + "_Original"]
|
||||
slot.material.use_fake_user = False
|
|
@ -56,8 +56,10 @@ def apply_materials():
|
|||
load_library("Exposure")
|
||||
|
||||
#Apply materials
|
||||
print(obj.name)
|
||||
for slot in obj.material_slots:
|
||||
mat = slot.material
|
||||
print(slot.material)
|
||||
|
||||
node_tree = mat.node_tree
|
||||
nodes = mat.node_tree.nodes
|
||||
|
|
|
@ -76,6 +76,13 @@ def configure_meshes(self):
|
|||
if obj.type == "MESH":
|
||||
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:
|
||||
|
||||
objWasHidden = False
|
||||
|
||||
#For some reason, a Blender bug might prevent invisible objects from being smart projected
|
||||
#We will turn the object temporarily visible
|
||||
obj.hide_viewport = False
|
||||
obj.hide_set(False)
|
||||
|
||||
currentIterNum = currentIterNum + 1
|
||||
|
||||
#Configure selection
|
||||
|
@ -244,6 +251,14 @@ def preprocess_material(obj, scene):
|
|||
|
||||
obj["TLM_PrevMatArray"] = matArray
|
||||
|
||||
#We check and safeguard against NoneType
|
||||
for slot in obj.material_slots:
|
||||
if slot.material is None:
|
||||
matName = obj.name + ".00" + str(0)
|
||||
bpy.data.materials.new(name=matName)
|
||||
slot.material = bpy.data.materials[matName]
|
||||
slot.material.use_nodes = True
|
||||
|
||||
for slot in obj.material_slots:
|
||||
|
||||
cache.backup_material_copy(slot)
|
||||
|
@ -253,54 +268,6 @@ def preprocess_material(obj, scene):
|
|||
copymat = mat.copy()
|
||||
slot.material = copymat
|
||||
|
||||
# for slot in obj.material_slots:
|
||||
# matname = slot.material.name
|
||||
# originalName = "." + matname + "_Original"
|
||||
# hasOriginal = False
|
||||
# if originalName in bpy.data.materials:
|
||||
# hasOriginal = True
|
||||
# else:
|
||||
# hasOriginal = False
|
||||
|
||||
# if hasOriginal:
|
||||
# cache.backup_material_restore(slot)
|
||||
|
||||
# cache.backup_material_copy(slot)
|
||||
|
||||
############################
|
||||
|
||||
#Make a material backup and restore original if exists
|
||||
# if scene.TLM_SceneProperties.tlm_caching_mode == "Copy":
|
||||
# for slot in obj.material_slots:
|
||||
# matname = slot.material.name
|
||||
# originalName = "." + matname + "_Original"
|
||||
# hasOriginal = False
|
||||
# if originalName in bpy.data.materials:
|
||||
# hasOriginal = True
|
||||
# else:
|
||||
# hasOriginal = False
|
||||
|
||||
# if hasOriginal:
|
||||
# matcache.backup_material_restore(slot)
|
||||
|
||||
# matcache.backup_material_copy(slot)
|
||||
|
||||
# else: #Cache blend
|
||||
# #TEST CACHE
|
||||
# filepath = bpy.data.filepath
|
||||
# dirpath = os.path.join(os.path.dirname(bpy.data.filepath), scene.TLM_SceneProperties.tlm_lightmap_savedir)
|
||||
# path = dirpath + "/cache.blend"
|
||||
# bpy.ops.wm.save_as_mainfile(filepath=path, copy=True)
|
||||
#print("Warning: Cache blend not supported")
|
||||
|
||||
# for mat in bpy.data.materials:
|
||||
# if mat.name.endswith('_baked'):
|
||||
# bpy.data.materials.remove(mat, do_unlink=True)
|
||||
# for img in bpy.data.images:
|
||||
# if img.name == obj.name + "_baked":
|
||||
# bpy.data.images.remove(img, do_unlink=True)
|
||||
|
||||
|
||||
#SOME ATLAS EXCLUSION HERE?
|
||||
ob = obj
|
||||
for slot in ob.material_slots:
|
||||
|
@ -448,5 +415,6 @@ def store_existing(prev_container):
|
|||
cycles.device,
|
||||
scene.render.engine,
|
||||
bpy.context.view_layer.objects.active,
|
||||
selected
|
||||
selected,
|
||||
[scene.render.resolution_x, scene.render.resolution_y]
|
||||
]
|
|
@ -1,7 +1,89 @@
|
|||
import bpy, os
|
||||
import bpy, os, platform, subprocess
|
||||
|
||||
class TLM_OIDN_Denoise:
|
||||
class TLM_Optix_Denoise:
|
||||
|
||||
def __init__(self):
|
||||
image_array = []
|
||||
|
||||
pass
|
||||
image_output_destination = ""
|
||||
|
||||
denoised_array = []
|
||||
|
||||
def __init__(self, optixProperties, img_array, dirpath):
|
||||
|
||||
self.optixProperties = optixProperties
|
||||
|
||||
self.image_array = img_array
|
||||
|
||||
self.image_output_destination = dirpath
|
||||
|
||||
self.check_binary()
|
||||
|
||||
def check_binary(self):
|
||||
|
||||
optixPath = self.optixProperties.tlm_optix_path
|
||||
|
||||
if optixPath != "":
|
||||
|
||||
file = os.path.basename(os.path.realpath(optixPath))
|
||||
filename, file_extension = os.path.splitext(file)
|
||||
|
||||
if(file_extension == ".exe"):
|
||||
|
||||
#if file exists optixDenoise or denoise
|
||||
|
||||
pass
|
||||
|
||||
else:
|
||||
|
||||
#if file exists optixDenoise or denoise
|
||||
|
||||
self.optixProperties.tlm_optix_path = os.path.join(self.optixProperties.tlm_optix_path,"Denoiser.exe")
|
||||
|
||||
else:
|
||||
|
||||
print("Please provide Optix path")
|
||||
|
||||
def denoise(self):
|
||||
|
||||
print("Optix: Denoising")
|
||||
for image in self.image_array:
|
||||
|
||||
if image not in self.denoised_array:
|
||||
|
||||
image_path = os.path.join(self.image_output_destination, image)
|
||||
|
||||
denoise_output_destination = image_path[:-10] + "_denoised.hdr"
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
optixPath = bpy.path.abspath(self.optixProperties.tlm_optix_path)
|
||||
pipePath = [optixPath, '-i', image_path, '-o', denoise_output_destination]
|
||||
elif platform.system() == 'Darwin':
|
||||
print("Mac for Optix is still unsupported")
|
||||
else:
|
||||
print("Linux for Optix is still unsupported")
|
||||
|
||||
if self.optixProperties.tlm_optix_verbose:
|
||||
denoisePipe = subprocess.Popen(pipePath, shell=True)
|
||||
else:
|
||||
denoisePipe = subprocess.Popen(pipePath, stdout=subprocess.PIPE, stderr=None, shell=True)
|
||||
|
||||
denoisePipe.communicate()[0]
|
||||
|
||||
image = bpy.data.images.load(image_path, check_existing=False)
|
||||
bpy.data.images[image.name].filepath_raw = bpy.data.images[image.name].filepath_raw[:-4] + "_denoised.hdr"
|
||||
bpy.data.images[image.name].reload()
|
||||
|
||||
def clean(self):
|
||||
|
||||
self.denoised_array.clear()
|
||||
self.image_array.clear()
|
||||
|
||||
for file in self.image_output_destination:
|
||||
if file.endswith("_baked.hdr"):
|
||||
baked_image_array.append(file)
|
||||
|
||||
#self.image_output_destination
|
||||
|
||||
#Clean temporary files here..
|
||||
#...pfm
|
||||
#...denoised.hdr
|
|
@ -8,7 +8,7 @@ import arm.proxy
|
|||
import arm.utils
|
||||
|
||||
# Armory version
|
||||
arm_version = '2020.7'
|
||||
arm_version = '2020.8'
|
||||
arm_commit = '$Id$'
|
||||
|
||||
def init_properties():
|
||||
|
|
|
@ -3,7 +3,7 @@ import arm.assets
|
|||
import bpy
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
from arm.lightmapper import operators, panels, properties, preferences, utility, keymap
|
||||
from arm.lightmapper import operators, properties, preferences, utility, keymap
|
||||
|
||||
class ArmBakeListItem(bpy.types.PropertyGroup):
|
||||
obj: PointerProperty(type=bpy.types.Object, description="The object to bake")
|
||||
|
@ -362,7 +362,6 @@ def register():
|
|||
operators.register()
|
||||
properties.register()
|
||||
preferences.register()
|
||||
panels.register()
|
||||
keymap.register()
|
||||
|
||||
def unregister():
|
||||
|
@ -384,5 +383,4 @@ def unregister():
|
|||
operators.unregister()
|
||||
properties.unregister()
|
||||
preferences.unregister()
|
||||
panels.unregister()
|
||||
keymap.unregister()
|
|
@ -1863,4 +1863,4 @@ def unregister():
|
|||
bpy.utils.unregister_class(ArmProxyApplyAllButton)
|
||||
bpy.utils.unregister_class(ArmSyncProxyButton)
|
||||
bpy.utils.unregister_class(ArmPrintTraitsButton)
|
||||
bpy.utils.unregister_class(ARM_PT_MaterialNodePanel)
|
||||
bpy.utils.unregister_class(ARM_PT_MaterialNodePanel)
|
Loading…
Reference in a new issue