Files
multi-user/multi_user/io_bpy/bl_lightprobe.py

78 lines
2.4 KiB
Python
Raw Normal View History

2020-03-20 14:56:50 +01: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 3 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, see <https://www.gnu.org/licenses/>.
#
# ##### END GPL LICENSE BLOCK #####
import bpy
import mathutils
import logging
from .dump_anything import Loader, Dumper
from .bl_datablock import BlDatablock
class BlLightprobe(BlDatablock):
bl_id = "lightprobes"
bl_class = bpy.types.LightProbe
2020-09-17 22:47:11 +02:00
bl_check_common = False
bl_icon = 'LIGHTPROBE_GRID'
bl_reload_parent = False
def construct(data: dict) -> object:
type = 'CUBE' if data['type'] == 'CUBEMAP' else data['type']
# See https://developer.blender.org/D6396
if bpy.app.version[1] >= 83:
return bpy.data.lightprobes.new(data["name"], type)
else:
2020-04-22 17:04:14 +02:00
logging.warning("Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396")
2020-03-27 18:18:36 +01:00
def load(data: dict, datablock: object):
2020-04-01 11:34:24 +02:00
loader = Loader()
loader.load(target, data)
def dump(datablock: object) -> dict:
assert(instance)
2020-02-07 10:50:14 +01:00
if bpy.app.version[1] < 83:
2020-04-22 17:04:14 +02:00
logging.warning("Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396")
2020-04-01 11:34:24 +02:00
dumper = Dumper()
dumper.depth = 1
dumper.include_filter = [
"name",
'type',
'influence_type',
'influence_distance',
'falloff',
'intensity',
'clip_start',
'clip_end',
'visibility_collection',
'use_custom_parallax',
'parallax_type',
'parallax_distance',
'grid_resolution_x',
'grid_resolution_y',
'grid_resolution_z',
'visibility_buffer_bias',
'visibility_bleed_bias',
'visibility_blur'
]
return dumper.dump(instance)
2020-03-11 15:17:13 +01:00
2020-03-09 15:59:30 +01:00