Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
40db41a9
Commit
40db41a9
authored
4 years ago
by
Julien Duroure
Browse files
Options
Downloads
Patches
Plain Diff
glTF exporter: Allow to call a pre and post callbacks
Thanks jjcasmar!
parent
c5bee7de
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
io_scene_gltf2/__init__.py
+9
-1
9 additions, 1 deletion
io_scene_gltf2/__init__.py
io_scene_gltf2/blender/exp/gltf2_blender_export.py
+8
-0
8 additions, 0 deletions
io_scene_gltf2/blender/exp/gltf2_blender_export.py
with
17 additions
and
1 deletion
io_scene_gltf2/__init__.py
+
9
−
1
View file @
40db41a9
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
bl_info
=
{
bl_info
=
{
'
name
'
:
'
glTF 2.0 format
'
,
'
name
'
:
'
glTF 2.0 format
'
,
'
author
'
:
'
Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors
'
,
'
author
'
:
'
Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors
'
,
"
version
"
:
(
1
,
3
,
3
0
),
"
version
"
:
(
1
,
3
,
3
1
),
'
blender
'
:
(
2
,
90
,
0
),
'
blender
'
:
(
2
,
90
,
0
),
'
location
'
:
'
File > Import-Export
'
,
'
location
'
:
'
File > Import-Export
'
,
'
description
'
:
'
Import-Export as glTF 2.0
'
,
'
description
'
:
'
Import-Export as glTF 2.0
'
,
...
@@ -485,6 +485,8 @@ class ExportGLTF2_Base:
...
@@ -485,6 +485,8 @@ class ExportGLTF2_Base:
bpy
.
path
.
ensure_ext
(
self
.
filepath
,
self
.
filename_ext
)))[
0
]
+
'
.bin
'
bpy
.
path
.
ensure_ext
(
self
.
filepath
,
self
.
filename_ext
)))[
0
]
+
'
.bin
'
user_extensions
=
[]
user_extensions
=
[]
pre_export_callbacks
=
[]
post_export_callbacks
=
[]
import
sys
import
sys
preferences
=
bpy
.
context
.
preferences
preferences
=
bpy
.
context
.
preferences
...
@@ -500,7 +502,13 @@ class ExportGLTF2_Base:
...
@@ -500,7 +502,13 @@ class ExportGLTF2_Base:
extension_ctors
=
module
.
glTF2ExportUserExtensions
extension_ctors
=
module
.
glTF2ExportUserExtensions
for
extension_ctor
in
extension_ctors
:
for
extension_ctor
in
extension_ctors
:
user_extensions
.
append
(
extension_ctor
())
user_extensions
.
append
(
extension_ctor
())
if
hasattr
(
module
,
'
glTF2_pre_export_callback
'
):
pre_export_callbacks
.
append
(
module
.
glTF2_pre_export_callback
)
if
hasattr
(
module
,
'
glTF2_post_export_callback
'
):
post_export_callbacks
.
append
(
module
.
glTF2_post_export_callback
)
export_settings
[
'
gltf_user_extensions
'
]
=
user_extensions
export_settings
[
'
gltf_user_extensions
'
]
=
user_extensions
export_settings
[
'
pre_export_callbacks
'
]
=
pre_export_callbacks
export_settings
[
'
post_export_callbacks
'
]
=
post_export_callbacks
return
gltf2_blender_export
.
save
(
context
,
export_settings
)
return
gltf2_blender_export
.
save
(
context
,
export_settings
)
...
...
This diff is collapsed.
Click to expand it.
io_scene_gltf2/blender/exp/gltf2_blender_export.py
+
8
−
0
View file @
40db41a9
...
@@ -39,7 +39,15 @@ def save(context, export_settings):
...
@@ -39,7 +39,15 @@ def save(context, export_settings):
__notify_start
(
context
)
__notify_start
(
context
)
start_time
=
time
.
time
()
start_time
=
time
.
time
()
pre_export_callbacks
=
export_settings
[
"
pre_export_callbacks
"
]
for
callback
in
pre_export_callbacks
:
callback
(
export_settings
)
json
,
buffer
=
__export
(
export_settings
)
json
,
buffer
=
__export
(
export_settings
)
post_export_callbacks
=
export_settings
[
"
post_export_callbacks
"
]
for
callback
in
post_export_callbacks
:
callback
(
export_settings
)
__write_file
(
json
,
buffer
,
export_settings
)
__write_file
(
json
,
buffer
,
export_settings
)
end_time
=
time
.
time
()
end_time
=
time
.
time
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment