1 # SPDX-FileCopyrightText: 2018-2021 The glTF-Blender-IO authors
3 # SPDX-License-Identifier: Apache-2.0
9 class BlenderJSONEncoder(json
.JSONEncoder
):
10 """Blender JSON Encoder."""
12 def default(self
, obj
):
13 if isinstance(obj
, bpy
.types
.ID
):
16 type=obj
.__class
__.__name
__
18 return super(BlenderJSONEncoder
, self
).default(obj
)
21 def is_json_convertible(data
):
22 """Test, if a data set can be expressed as JSON."""
24 json
.dumps(data
, cls
=BlenderJSONEncoder
)