# Path: blendergltf/exporters/base.py
# class BaseExporter:
#     gltf_key = ''
#     blender_key = ''
# 
#     @classmethod
#     def get_custom_properties(cls, blender_data):
#         custom_props = {
#             key: value.to_list() if hasattr(value, 'to_list') else value
#             for key, value in blender_data.items()
#             if key not in _IGNORED_CUSTOM_PROPS
#         }
# 
#         custom_props = {
#             key: value for key, value in custom_props.items()
#             if _is_serializable(value)
#         }
# 
#         return custom_props
# 
#     @classmethod
#     def check(cls, state, blender_data):
#         return True
# 
#     @classmethod
#     def default(cls, state, blender_data):
#         return {
#             'name': blender_data.name
#         }
# 
#     @classmethod
#     def export(cls, state, blender_data):
#         return {}
# 
# Path: blendergltf/exporters/common.py
# class Reference:
#     __slots__ = (
#         "blender_type",
#         "blender_name",
#         "source",
#         "prop",
#         "value",
#     )
# 
#     def __init__(self, blender_type, blender_name, source, prop):
#         self.blender_type = blender_type
#         self.blender_name = blender_name
#         self.source = source
#         self.prop = prop
#         self.value = None
# 
#     def __str__(self):
#         return json.dumps([self.blender_type, self.blender_name, self.value])


from .base import BaseExporter
from .common import (
    Reference,
)

class SceneExporter(BaseExporter):
    gltf_key = 'scenes'
    blender_key = 'scenes'

    @classmethod
    def export(cls, state, blender_data):
        bg_color = blender_data.world.horizon_color[:] if blender_data.world else [0.05]*3
        result = {
            'extras': {
                'background_color': bg_color,
                'frames_per_second': blender_data.render.fps,
            },
            'name': blender_data.name,
        }

        if blender_data.camera and blender_data.camera.data in state['input']['cameras']:
            result['extras']['active_camera'] = Reference(
                'cameras',
                blender_data.camera.name,
                result['extras'],
                'active_camera'
            )
            state['references'].append(result['extras']['active_camera'])

        extras = BaseExporter.get_custom_properties(blender_data)
        if extras:
            result['extras'].update(BaseExporter.get_custom_properties(blender_data))

        result['nodes'] = [

# Path: blendergltf/exporters/base.py
# class BaseExporter:
#     gltf_key = ''
#     blender_key = ''
# 
#     @classmethod
#     def get_custom_properties(cls, blender_data):
#         custom_props = {
#             key: value.to_list() if hasattr(value, 'to_list') else value
#             for key, value in blender_data.items()
#             if key not in _IGNORED_CUSTOM_PROPS
#         }
# 
#         custom_props = {
#             key: value for key, value in custom_props.items()
#             if _is_serializable(value)
#         }
# 
#         return custom_props
# 
#     @classmethod
#     def check(cls, state, blender_data):
#         return True
# 
#     @classmethod
#     def default(cls, state, blender_data):
#         return {
#             'name': blender_data.name
#         }
# 
#     @classmethod
#     def export(cls, state, blender_data):
#         return {}
# 
# Path: blendergltf/exporters/common.py
# class Reference:
#     __slots__ = (
#         "blender_type",
#         "blender_name",
#         "source",
#         "prop",
#         "value",
#     )
# 
#     def __init__(self, blender_type, blender_name, source, prop):
#         self.blender_type = blender_type
#         self.blender_name = blender_name
#         self.source = source
#         self.prop = prop
#         self.value = None
# 
#     def __str__(self):
#         return json.dumps([self.blender_type, self.blender_name, self.value])


# Path: blendergltf/exporters/scene.py
from .base import BaseExporter
from .common import (
    Reference,
)


class SceneExporter(BaseExporter):
    gltf_key = 'scenes'
    blender_key = 'scenes'

    @classmethod
    def export(cls, state, blender_data):
        bg_color = blender_data.world.horizon_color[:] if blender_data.world else [0.05]*3
        result = {
            'extras': {
                'background_color': bg_color,
                'frames_per_second': blender_data.render.fps,
            },
            'name': blender_data.name,
        }

        if blender_data.camera and blender_data.camera.data in state['input']['cameras']:
            result['extras']['active_camera'] = Reference(
                'cameras',
                blender_data.camera.name,
                result['extras'],
                'active_camera'
            )
            state['references'].append(result['extras']['active_camera'])

        extras = BaseExporter.get_custom_properties(blender_data)
        if extras:
            result['extras'].update(BaseExporter.get_custom_properties(blender_data))

        result['nodes'] = [

            Reference('objects', ob.name, None, None)