diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-12-14 10:42:04 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-12-14 10:42:04 +0300 |
commit | 18246268e802958bf02ffa14c764d2cc32ddb4d4 (patch) | |
tree | 9359d37137116430f478945f938e71a1d3be8929 /io_scene_gltf2/io | |
parent | 13b7618409aac26eb512133373828ab9e92a6ac7 (diff) |
glTF exporter: define a user extension API
Diffstat (limited to 'io_scene_gltf2/io')
-rw-r--r-- | io_scene_gltf2/io/exp/gltf2_io_user_extensions.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/io_scene_gltf2/io/exp/gltf2_io_user_extensions.py b/io_scene_gltf2/io/exp/gltf2_io_user_extensions.py new file mode 100644 index 00000000..f8f5e883 --- /dev/null +++ b/io_scene_gltf2/io/exp/gltf2_io_user_extensions.py @@ -0,0 +1,23 @@ +# Copyright 2019 The glTF-Blender-IO authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +def export_user_extensions(hook_name, export_settings, gltf2_object, *args): + if gltf2_object.extensions is None: + gltf2_object.extensions = {} + + for extension in export_settings['gltf_user_extensions']: + hook = getattr(extension, hook_name, None) + if hook is not None: + hook(gltf2_object, *args, export_settings) + |