2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
2023-06-15 13:09:04 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-06-15 13:09:04 +10:00
|
|
|
|
2017-06-07 18:32:27 +02:00
|
|
|
from bpy.types import Panel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DataButtonsPanel:
|
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
|
bl_context = "data"
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def poll(cls, context):
|
2017-10-16 17:15:03 -02:00
|
|
|
engine = context.engine
|
2017-06-12 20:59:54 +10:00
|
|
|
return context.lightprobe and (engine in cls.COMPAT_ENGINES)
|
2017-06-07 18:32:27 +02:00
|
|
|
|
|
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
class DATA_PT_context_lightprobe(DataButtonsPanel, Panel):
|
2017-06-07 18:32:27 +02:00
|
|
|
bl_label = ""
|
|
|
|
|
bl_options = {'HIDE_HEADER'}
|
2023-06-23 08:39:46 +02:00
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER', 'BLENDER_EEVEE_NEXT'}
|
2017-06-07 18:32:27 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
ob = context.object
|
2017-06-12 20:59:54 +10:00
|
|
|
probe = context.lightprobe
|
2017-06-07 18:32:27 +02:00
|
|
|
space = context.space_data
|
|
|
|
|
|
|
|
|
|
if ob:
|
|
|
|
|
layout.template_ID(ob, "data")
|
|
|
|
|
elif probe:
|
|
|
|
|
layout.template_ID(space, "pin_id")
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
class DATA_PT_lightprobe(DataButtonsPanel, Panel):
|
2017-06-07 18:32:27 +02:00
|
|
|
bl_label = "Probe"
|
2019-01-22 15:31:14 +01:00
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
|
2017-06-07 18:32:27 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
2018-06-01 18:44:06 +02:00
|
|
|
layout.use_property_split = True
|
2017-06-07 18:32:27 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
probe = context.lightprobe
|
2017-06-07 18:32:27 +02:00
|
|
|
|
2018-06-01 18:44:06 +02:00
|
|
|
# layout.prop(probe, "type")
|
2017-06-10 00:36:33 +02:00
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type == 'VOLUME':
|
2018-06-01 18:44:06 +02:00
|
|
|
col = layout.column()
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "influence_distance", text="Distance")
|
2017-06-17 01:55:49 +02:00
|
|
|
col.prop(probe, "falloff")
|
2018-01-21 23:15:57 +01:00
|
|
|
col.prop(probe, "intensity")
|
2017-06-22 17:20:39 +02:00
|
|
|
|
2019-02-18 14:10:07 +11:00
|
|
|
sub = col.column(align=True)
|
|
|
|
|
sub.prop(probe, "grid_resolution_x", text="Resolution X")
|
|
|
|
|
sub.prop(probe, "grid_resolution_y", text="Y")
|
|
|
|
|
sub.prop(probe, "grid_resolution_z", text="Z")
|
2018-06-01 18:44:06 +02:00
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
elif probe.type == 'PLANE':
|
2018-06-01 18:44:06 +02:00
|
|
|
col = layout.column()
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "influence_distance", text="Distance")
|
2018-11-22 16:14:56 +01:00
|
|
|
col.prop(probe, "falloff")
|
2017-06-09 22:30:49 +02:00
|
|
|
else:
|
2018-06-01 18:44:06 +02:00
|
|
|
col = layout.column()
|
|
|
|
|
col.prop(probe, "influence_type")
|
2017-06-09 22:30:49 +02:00
|
|
|
|
2017-06-13 15:56:04 +02:00
|
|
|
if probe.influence_type == 'ELIPSOID':
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "influence_distance", text="Radius")
|
2017-06-13 15:56:04 +02:00
|
|
|
else:
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "influence_distance", text="Size")
|
2017-06-13 15:56:04 +02:00
|
|
|
|
|
|
|
|
col.prop(probe, "falloff")
|
2018-01-21 23:15:57 +01:00
|
|
|
col.prop(probe, "intensity")
|
2017-06-09 22:30:49 +02:00
|
|
|
|
2019-02-18 14:10:07 +11:00
|
|
|
sub = col.column(align=True)
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type != 'PLANE':
|
2018-11-22 16:14:56 +01:00
|
|
|
sub.prop(probe, "clip_start", text="Clipping Start")
|
|
|
|
|
else:
|
|
|
|
|
sub.prop(probe, "clip_start", text="Clipping Offset")
|
2017-06-22 17:20:39 +02:00
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type != 'PLANE':
|
2018-06-01 18:44:06 +02:00
|
|
|
sub.prop(probe, "clip_end", text="End")
|
2017-06-09 22:30:49 +02:00
|
|
|
|
2019-02-18 14:10:07 +11:00
|
|
|
|
2023-06-23 08:39:46 +02:00
|
|
|
class DATA_PT_lightprobe_eevee_next(DataButtonsPanel, Panel):
|
|
|
|
|
bl_label = "Probe"
|
|
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE_NEXT'}
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
layout.use_property_split = True
|
|
|
|
|
|
|
|
|
|
probe = context.lightprobe
|
|
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type == 'VOLUME':
|
2023-06-23 08:39:46 +02:00
|
|
|
col = layout.column()
|
|
|
|
|
|
|
|
|
|
sub = col.column(align=True)
|
|
|
|
|
sub.prop(probe, "grid_resolution_x", text="Resolution X")
|
|
|
|
|
sub.prop(probe, "grid_resolution_y", text="Y")
|
|
|
|
|
sub.prop(probe, "grid_resolution_z", text="Z")
|
|
|
|
|
|
|
|
|
|
col.separator()
|
|
|
|
|
|
2023-09-04 23:27:30 +02:00
|
|
|
col.prop(probe, "intensity")
|
|
|
|
|
|
|
|
|
|
col.separator()
|
|
|
|
|
|
2023-09-13 13:36:00 +10:00
|
|
|
col.operator("object.lightprobe_cache_bake").subset = 'ACTIVE'
|
|
|
|
|
col.operator("object.lightprobe_cache_free").subset = 'ACTIVE'
|
2023-06-23 08:39:46 +02:00
|
|
|
|
|
|
|
|
col.separator()
|
|
|
|
|
|
|
|
|
|
col.prop(probe, "grid_bake_samples")
|
|
|
|
|
col.prop(probe, "surfel_density")
|
2023-09-26 19:45:41 +02:00
|
|
|
col.prop(probe, "clip_end", text="Capture Distance")
|
2023-06-23 08:39:46 +02:00
|
|
|
|
2023-07-20 19:03:08 +02:00
|
|
|
col.separator()
|
|
|
|
|
|
2023-09-04 23:27:30 +02:00
|
|
|
col.prop(probe, "grid_clamp_direct")
|
|
|
|
|
col.prop(probe, "grid_clamp_indirect")
|
|
|
|
|
|
|
|
|
|
col.separator()
|
|
|
|
|
|
2023-07-20 19:03:08 +02:00
|
|
|
col.prop(probe, "grid_normal_bias")
|
|
|
|
|
col.prop(probe, "grid_view_bias")
|
|
|
|
|
col.prop(probe, "grid_irradiance_smoothing")
|
2023-08-06 13:43:17 +02:00
|
|
|
col.prop(probe, "grid_validity_threshold")
|
2023-07-20 19:03:08 +02:00
|
|
|
|
2023-08-03 15:48:33 +02:00
|
|
|
col.separator()
|
|
|
|
|
|
2023-08-03 16:47:05 +02:00
|
|
|
col.prop(probe, "grid_surface_bias")
|
|
|
|
|
col.prop(probe, "grid_escape_bias")
|
|
|
|
|
|
|
|
|
|
col.separator()
|
|
|
|
|
|
2023-08-03 15:48:33 +02:00
|
|
|
col.prop(probe, "grid_dilation_threshold")
|
|
|
|
|
col.prop(probe, "grid_dilation_radius")
|
|
|
|
|
|
2023-08-05 20:23:38 +02:00
|
|
|
col.separator()
|
|
|
|
|
|
2023-08-06 16:30:12 +02:00
|
|
|
col.prop(probe, "grid_capture_world")
|
|
|
|
|
col.prop(probe, "grid_capture_indirect")
|
|
|
|
|
col.prop(probe, "grid_capture_emission")
|
|
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
elif probe.type == 'SPHERE':
|
2023-10-11 20:19:37 +02:00
|
|
|
col = layout.column()
|
|
|
|
|
col.prop(probe, "influence_type")
|
|
|
|
|
|
|
|
|
|
if probe.influence_type == 'ELIPSOID':
|
|
|
|
|
influence_text = "Radius"
|
|
|
|
|
else:
|
|
|
|
|
influence_text = "Size"
|
|
|
|
|
|
|
|
|
|
col.prop(probe, "influence_distance", text=influence_text)
|
|
|
|
|
col.prop(probe, "falloff")
|
|
|
|
|
|
2023-07-14 11:22:18 +02:00
|
|
|
sub = layout.column(align=True)
|
|
|
|
|
sub.prop(probe, "clip_start", text="Clipping Start")
|
|
|
|
|
sub.prop(probe, "clip_end", text="End")
|
2023-07-07 15:37:26 +02:00
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
elif probe.type == 'PLANE':
|
2023-10-08 19:49:58 +02:00
|
|
|
col = layout.column()
|
|
|
|
|
row = col.row()
|
|
|
|
|
col.prop(probe, "clip_start", text="Clipping Offset")
|
2023-10-10 12:55:18 +02:00
|
|
|
col.prop(probe, "influence_distance", text="Distance")
|
2023-06-23 08:39:46 +02:00
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
# Currently unsupported
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2019-02-18 14:10:07 +11:00
|
|
|
class DATA_PT_lightprobe_visibility(DataButtonsPanel, Panel):
|
|
|
|
|
bl_label = "Visibility"
|
|
|
|
|
bl_parent_id = "DATA_PT_lightprobe"
|
|
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
layout.use_property_split = True
|
|
|
|
|
|
|
|
|
|
probe = context.lightprobe
|
|
|
|
|
|
|
|
|
|
col = layout.column()
|
|
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type == 'VOLUME':
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "visibility_buffer_bias", text="Bias")
|
|
|
|
|
col.prop(probe, "visibility_bleed_bias", text="Bleed Bias")
|
|
|
|
|
col.prop(probe, "visibility_blur", text="Blur")
|
2018-01-21 23:15:57 +01:00
|
|
|
|
2018-04-24 12:15:25 +02:00
|
|
|
row = col.row(align=True)
|
2018-06-01 18:44:06 +02:00
|
|
|
row.prop(probe, "visibility_collection")
|
2018-05-28 21:27:00 +02:00
|
|
|
row.prop(probe, "invert_visibility_collection", text="", icon='ARROW_LEFTRIGHT')
|
2018-04-24 12:15:25 +02:00
|
|
|
|
|
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
class DATA_PT_lightprobe_parallax(DataButtonsPanel, Panel):
|
2018-04-25 10:50:41 +02:00
|
|
|
bl_label = "Custom Parallax"
|
2018-10-18 12:13:06 +02:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2023-10-11 20:19:37 +02:00
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER', 'BLENDER_EEVEE_NEXT'}
|
2017-06-09 22:30:49 +02:00
|
|
|
|
2017-06-13 15:56:04 +02:00
|
|
|
@classmethod
|
|
|
|
|
def poll(cls, context):
|
2017-10-16 17:15:03 -02:00
|
|
|
engine = context.engine
|
2023-10-11 19:38:42 +02:00
|
|
|
return context.lightprobe and context.lightprobe.type == 'SPHERE' and (engine in cls.COMPAT_ENGINES)
|
2017-06-13 15:56:04 +02:00
|
|
|
|
2018-04-25 10:50:41 +02:00
|
|
|
def draw_header(self, context):
|
|
|
|
|
probe = context.lightprobe
|
|
|
|
|
self.layout.prop(probe, "use_custom_parallax", text="")
|
|
|
|
|
|
2017-06-09 22:30:49 +02:00
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
2018-06-01 18:44:06 +02:00
|
|
|
layout.use_property_split = True
|
2017-06-09 22:30:49 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
probe = context.lightprobe
|
2017-06-09 22:30:49 +02:00
|
|
|
|
|
|
|
|
col = layout.column()
|
|
|
|
|
col.active = probe.use_custom_parallax
|
|
|
|
|
|
2018-06-01 18:44:06 +02:00
|
|
|
col.prop(probe, "parallax_type")
|
2017-06-09 22:30:49 +02:00
|
|
|
|
|
|
|
|
if probe.parallax_type == 'ELIPSOID':
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "parallax_distance", text="Radius")
|
2017-06-09 22:30:49 +02:00
|
|
|
else:
|
2018-08-28 13:41:47 +10:00
|
|
|
col.prop(probe, "parallax_distance", text="Size")
|
2017-06-09 23:21:23 +02:00
|
|
|
|
2017-06-10 00:36:33 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
class DATA_PT_lightprobe_display(DataButtonsPanel, Panel):
|
2018-10-18 12:13:06 +02:00
|
|
|
bl_label = "Viewport Display"
|
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2019-01-22 15:31:14 +01:00
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
|
2017-06-10 00:36:33 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
2018-06-01 18:44:06 +02:00
|
|
|
layout.use_property_split = True
|
2017-06-10 00:36:33 +02:00
|
|
|
|
|
|
|
|
ob = context.object
|
2017-06-12 20:59:54 +10:00
|
|
|
probe = context.lightprobe
|
2017-06-10 00:36:33 +02:00
|
|
|
|
2018-06-01 18:44:06 +02:00
|
|
|
col = layout.column()
|
2017-06-22 17:37:28 +02:00
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type == 'PLANE':
|
2018-09-03 18:58:41 +02:00
|
|
|
col.prop(ob, "empty_display_size", text="Arrow Size")
|
2019-12-02 01:40:58 +01:00
|
|
|
col.prop(probe, "show_influence")
|
2018-07-20 22:22:30 +02:00
|
|
|
col.prop(probe, "show_data")
|
2017-10-01 01:23:48 +02:00
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type in {'VOLUME', 'SPHERE'}:
|
2017-10-01 01:23:48 +02:00
|
|
|
col.prop(probe, "show_influence")
|
|
|
|
|
col.prop(probe, "show_clip")
|
|
|
|
|
|
2023-10-11 19:38:42 +02:00
|
|
|
if probe.type == 'SPHERE':
|
2018-06-01 18:44:06 +02:00
|
|
|
sub = col.column()
|
|
|
|
|
sub.active = probe.use_custom_parallax
|
|
|
|
|
sub.prop(probe, "show_parallax")
|
2017-10-01 01:23:48 +02:00
|
|
|
|
2017-06-07 18:32:27 +02:00
|
|
|
|
|
|
|
|
classes = (
|
2017-06-12 20:59:54 +10:00
|
|
|
DATA_PT_context_lightprobe,
|
|
|
|
|
DATA_PT_lightprobe,
|
2023-06-23 08:39:46 +02:00
|
|
|
DATA_PT_lightprobe_eevee_next,
|
2019-02-18 14:10:07 +11:00
|
|
|
DATA_PT_lightprobe_visibility,
|
2017-06-12 20:59:54 +10:00
|
|
|
DATA_PT_lightprobe_parallax,
|
|
|
|
|
DATA_PT_lightprobe_display,
|
2017-06-07 18:32:27 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
|
from bpy.utils import register_class
|
|
|
|
|
for cls in classes:
|
|
|
|
|
register_class(cls)
|