1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
# SPDX-License-Identifier: GPL-2.0-or-later
from bpy.types import Panel
class DataButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
@classmethod
def poll(cls, context):
engine = context.engine
return context.lightprobe and (engine in cls.COMPAT_ENGINES)
class DATA_PT_context_lightprobe(DataButtonsPanel, Panel):
bl_label = ""
bl_options = {'HIDE_HEADER'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
ob = context.object
probe = context.lightprobe
space = context.space_data
if ob:
layout.template_ID(ob, "data")
elif probe:
layout.template_ID(space, "pin_id")
class DATA_PT_lightprobe(DataButtonsPanel, Panel):
bl_label = "Probe"
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
probe = context.lightprobe
# layout.prop(probe, "type")
if probe.type == 'GRID':
col = layout.column()
col.prop(probe, "influence_distance", text="Distance")
col.prop(probe, "falloff")
col.prop(probe, "intensity")
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")
elif probe.type == 'PLANAR':
col = layout.column()
col.prop(probe, "influence_distance", text="Distance")
col.prop(probe, "falloff")
else:
col = layout.column()
col.prop(probe, "influence_type")
if probe.influence_type == 'ELIPSOID':
col.prop(probe, "influence_distance", text="Radius")
else:
col.prop(probe, "influence_distance", text="Size")
col.prop(probe, "falloff")
col.prop(probe, "intensity")
sub = col.column(align=True)
if probe.type != 'PLANAR':
sub.prop(probe, "clip_start", text="Clipping Start")
else:
sub.prop(probe, "clip_start", text="Clipping Offset")
if probe.type != 'PLANAR':
sub.prop(probe, "clip_end", text="End")
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()
if probe.type == 'GRID':
col.prop(probe, "visibility_buffer_bias", text="Bias")
col.prop(probe, "visibility_bleed_bias", text="Bleed Bias")
col.prop(probe, "visibility_blur", text="Blur")
row = col.row(align=True)
row.prop(probe, "visibility_collection")
row.prop(probe, "invert_visibility_collection", text="", icon='ARROW_LEFTRIGHT')
class DATA_PT_lightprobe_parallax(DataButtonsPanel, Panel):
bl_label = "Custom Parallax"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
engine = context.engine
return context.lightprobe and context.lightprobe.type == 'CUBEMAP' and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
probe = context.lightprobe
self.layout.prop(probe, "use_custom_parallax", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
probe = context.lightprobe
col = layout.column()
col.active = probe.use_custom_parallax
col.prop(probe, "parallax_type")
if probe.parallax_type == 'ELIPSOID':
col.prop(probe, "parallax_distance", text="Radius")
else:
col.prop(probe, "parallax_distance", text="Size")
class DATA_PT_lightprobe_display(DataButtonsPanel, Panel):
bl_label = "Viewport Display"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
ob = context.object
probe = context.lightprobe
col = layout.column()
if probe.type == 'PLANAR':
col.prop(ob, "empty_display_size", text="Arrow Size")
col.prop(probe, "show_influence")
col.prop(probe, "show_data")
if probe.type in {'GRID', 'CUBEMAP'}:
col.prop(probe, "show_influence")
col.prop(probe, "show_clip")
if probe.type == 'CUBEMAP':
sub = col.column()
sub.active = probe.use_custom_parallax
sub.prop(probe, "show_parallax")
classes = (
DATA_PT_context_lightprobe,
DATA_PT_lightprobe,
DATA_PT_lightprobe_visibility,
DATA_PT_lightprobe_parallax,
DATA_PT_lightprobe_display,
)
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)
|