Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2022-02-16 14:09:33 +0300
committerJulien Duroure <julien.duroure@gmail.com>2022-02-16 14:09:33 +0300
commit54c223a166c8d37ed4a004ec7cb5a25afc0223af (patch)
tree3502efad19f47571e9e82160f6b7fc6028da3cd6
parent38956097e34c48e984d229553e1d2b9dab9599b3 (diff)
glTF vtree: merge
-rwxr-xr-xio_scene_gltf2/__init__.py4
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_export.py4
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py6
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py2
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_image.py2
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_node.py2
6 files changed, 14 insertions, 6 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index a1b04c41..e1bc6dff 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
- "version": (3, 2, 5),
+ "version": (3, 2, 6),
'blender': (3, 1, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@@ -161,7 +161,7 @@ class ExportGLTF2_Base:
'Save images as JPEGs. (Images that need alpha are saved as PNGs though.) '
'Be aware of a possible loss in quality'),
('NONE', 'None',
- 'Don\'t export images.'),
+ 'Don\'t export images'),
),
description=(
'Output format for images. PNG is lossless and generally preferred, but JPEG might be preferable for web '
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export.py b/io_scene_gltf2/blender/exp/gltf2_blender_export.py
index fc78e9b5..dc04fad2 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_export.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_export.py
@@ -64,7 +64,7 @@ def __export(export_settings):
buffer = __create_buffer(exporter, export_settings)
exporter.finalize_images()
- export_user_extensions('gather_gltf_hook', export_settings, exporter.glTF)
+ export_user_extensions('gather_gltf_extensions_hook', export_settings, exporter.glTF)
exporter.traverse_extensions()
# now that addons possibly add some fields in json, we can fix in needed
@@ -80,6 +80,8 @@ def __gather_gltf(exporter, export_settings):
gltf2_io_draco_compression_extension.encode_scene_primitives(scenes, export_settings)
exporter.add_draco_extension()
+ export_user_extensions('gather_gltf_hook', export_settings, active_scene_idx, scenes, animations)
+
for idx, scene in enumerate(scenes):
exporter.add_scene(scene, idx==active_scene_idx)
for animation in animations:
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
index 0d249660..8939bb23 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -172,6 +172,8 @@ def __gather_animation( obj_uuid: int,
print_console("WARNING", "Animation '{}' could not be exported. Cause: {}".format(name, error))
return None
+ export_user_extensions('pre_gather_animation_hook', export_settings, animation, blender_action, blender_object)
+
if not animation.channels:
return None
@@ -266,6 +268,8 @@ def __get_blender_actions(blender_object: bpy.types.Object,
blender_tracks = {}
action_on_type = {}
+ export_user_extensions('pre_gather_actions_hook', export_settings, blender_object)
+
if blender_object.animation_data is not None:
# Collect active action.
if blender_object.animation_data.action is not None:
@@ -308,6 +312,8 @@ def __get_blender_actions(blender_object: bpy.types.Object,
blender_tracks[strip.action.name] = track.name # Always set after possible active action -> None will be overwrite
action_on_type[strip.action.name] = "SHAPEKEY"
+ export_user_extensions('gather_actions_hook', export_settings, blender_object, blender_actions, blender_tracks, action_on_type)
+
# Remove duplicate actions.
blender_actions = list(set(blender_actions))
# sort animations alphabetically (case insensitive) so they have a defined order and match Blender's Action list
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py
index e885b21b..11f0fadc 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py
@@ -53,7 +53,7 @@ def __gather_base_color_factor(blender_material, export_settings):
alpha_socket = gltf2_blender_get.get_socket(blender_material, "Alpha")
if isinstance(alpha_socket, bpy.types.NodeSocket):
- if export_settings['gltf_image_format'] != "NONE":
+ if export_settings['gltf_image_format'] != "NONE":
alpha = gltf2_blender_get.get_factor_from_socket(alpha_socket, kind='VALUE')
else:
alpha = gltf2_blender_get.get_const_from_default_value_socket(alpha_socket, kind='VALUE')
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_image.py b/io_scene_gltf2/blender/imp/gltf2_blender_image.py
index cf4a9595..200f3241 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_image.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_image.py
@@ -87,7 +87,7 @@ def create_from_file(gltf, img_idx):
blender_image.name = img_name
return blender_image
-
+
def create_from_data(gltf, img_idx):
# Image stored as data => pack
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_node.py
index 2fdbcfa5..224349ab 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_node.py
@@ -132,7 +132,7 @@ class BlenderNode():
vnode = gltf.vnodes[vid]
dist = vnode.trs()[0].length
sizes.append(dist * 0.4)
- return max(min(sizes, default=1), 0.001)
+ return max(min(sizes, default=1), 0.001)
@staticmethod
def create_bones(gltf, arma_id):