2017-06-07 18:32:27 +02:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
|
|
|
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'}
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
2017-06-13 15:56:04 +02:00
|
|
|
if probe.type == 'GRID':
|
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
|
|
|
|
2017-06-22 17:20:39 +02:00
|
|
|
elif probe.type == 'PLANAR':
|
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)
|
2018-11-22 16:14:56 +01:00
|
|
|
if probe.type != 'PLANAR':
|
|
|
|
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
|
|
|
|
2018-09-03 14:15:18 +10:00
|
|
|
if probe.type != 'PLANAR':
|
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
|
|
|
|
|
|
|
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()
|
|
|
|
|
2018-01-21 23:15:57 +01:00
|
|
|
if probe.type == 'GRID':
|
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'}
|
2019-01-22 15:31:14 +01:00
|
|
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
|
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
|
2017-06-14 10:36:33 +02:00
|
|
|
return context.lightprobe and context.lightprobe.type == 'CUBEMAP' 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
|
|
|
|
2018-07-20 22:22:30 +02:00
|
|
|
if probe.type == 'PLANAR':
|
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
|
|
|
|
|
|
|
if probe.type in {'GRID', 'CUBEMAP'}:
|
|
|
|
col.prop(probe, "show_influence")
|
|
|
|
col.prop(probe, "show_clip")
|
|
|
|
|
|
|
|
if probe.type == 'CUBEMAP':
|
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,
|
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)
|