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

76 lines
2.1 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
from .dump_anything import Loader, Dumper
from .bl_datablock import BlDatablock
2019-08-27 16:44:36 +02:00
class BlLight(BlDatablock):
bl_id = "lights"
bl_class = bpy.types.Light
2020-09-17 22:47:11 +02:00
bl_check_common = False
bl_icon = 'LIGHT_DATA'
bl_reload_parent = False
def construct(data: dict) -> object:
return bpy.data.lights.new(data["name"], data["type"])
2019-08-27 16:44:36 +02: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-04-01 11:34:24 +02:00
dumper = Dumper()
2019-09-24 00:42:30 +02:00
dumper.depth = 3
dumper.include_filter = [
2019-09-20 22:37:32 +02:00
"name",
"type",
"color",
"energy",
"specular_factor",
"uuid",
"shadow_soft_size",
"use_custom_distance",
"cutoff_distance",
"use_shadow",
"shadow_buffer_clip_start",
"shadow_buffer_soft",
"shadow_buffer_bias",
"shadow_buffer_bleed_bias",
"contact_shadow_distance",
"contact_shadow_soft_size",
"contact_shadow_bias",
2020-03-26 17:13:30 +01:00
"contact_shadow_thickness",
2020-04-06 15:16:57 +02:00
"shape",
"size_y",
"size",
2020-05-01 22:58:27 +02:00
"angle",
'spot_size',
'spot_blend'
2019-09-20 22:37:32 +02:00
]
data = dumper.dump(instance)
2019-09-20 22:37:32 +02:00
return data
2019-08-27 16:44:36 +02:00
2020-03-11 15:17:13 +01:00
2020-03-09 15:59:30 +01:00