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:
Diffstat (limited to 'io_scene_gltf2/__init__.py')
-rwxr-xr-xio_scene_gltf2/__init__.py47
1 files changed, 43 insertions, 4 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 2c61a9ed..08260263 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -4,7 +4,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, 4, 39),
+ "version": (3, 4, 40),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@@ -98,7 +98,21 @@ def on_export_format_changed(self, context):
)
-class ExportGLTF2_Base:
+class ConvertGLTF2_Base:
+ """Base class containing options that should be exposed during both import and export."""
+
+ convert_lighting_mode: EnumProperty(
+ name='Lighting Mode',
+ items=(
+ ('SPEC', 'Standard', 'Physically-based glTF lighting units (cd, lx, nt)'),
+ ('COMPAT', 'Unitless', 'Non-physical, unitless lighting. Useful when exposure controls are not available'),
+ ('RAW', 'Raw (Deprecated)', 'Blender lighting strengths with no conversion'),
+ ),
+ description='Optional backwards compatibility for non-standard render engines. Applies to lights',# TODO: and emissive materials',
+ default='SPEC'
+ )
+
+class ExportGLTF2_Base(ConvertGLTF2_Base):
# TODO: refactor to avoid boilerplate
def __init__(self):
@@ -643,6 +657,7 @@ class ExportGLTF2_Base:
export_settings['gltf_morph_tangent'] = False
export_settings['gltf_lights'] = self.export_lights
+ export_settings['gltf_lighting_mode'] = self.convert_lighting_mode
export_settings['gltf_binary'] = bytearray()
export_settings['gltf_binaryfilename'] = (
@@ -778,7 +793,7 @@ class GLTF_PT_export_transform(bpy.types.Panel):
class GLTF_PT_export_geometry(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
- bl_label = "Geometry"
+ bl_label = "Data"
bl_parent_id = "FILE_PT_operator"
bl_options = {'DEFAULT_CLOSED'}
@@ -876,6 +891,28 @@ class GLTF_PT_export_geometry_original_pbr(bpy.types.Panel):
layout.prop(operator, 'export_original_specular')
+class GLTF_PT_export_geometry_lighting(bpy.types.Panel):
+ bl_space_type = 'FILE_BROWSER'
+ bl_region_type = 'TOOL_PROPS'
+ bl_label = "Lighting"
+ bl_parent_id = "GLTF_PT_export_geometry"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ sfile = context.space_data
+ operator = sfile.active_operator
+ return operator.bl_idname == "EXPORT_SCENE_OT_gltf"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False # No animation.
+
+ sfile = context.space_data
+ operator = sfile.active_operator
+
+ layout.prop(operator, 'convert_lighting_mode')
class GLTF_PT_export_geometry_compression(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
@@ -1106,7 +1143,7 @@ def menu_func_export(self, context):
self.layout.operator(ExportGLTF2.bl_idname, text='glTF 2.0 (.glb/.gltf)')
-class ImportGLTF2(Operator, ImportHelper):
+class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
"""Load a glTF 2.0 file"""
bl_idname = 'import_scene.gltf'
bl_label = 'Import glTF 2.0'
@@ -1189,6 +1226,7 @@ class ImportGLTF2(Operator, ImportHelper):
layout.prop(self, 'import_shading')
layout.prop(self, 'guess_original_bind_pose')
layout.prop(self, 'bone_heuristic')
+ layout.prop(self, 'convert_lighting_mode')
def invoke(self, context, event):
import sys
@@ -1320,6 +1358,7 @@ classes = (
GLTF_PT_export_geometry_mesh,
GLTF_PT_export_geometry_material,
GLTF_PT_export_geometry_original_pbr,
+ GLTF_PT_export_geometry_lighting,
GLTF_PT_export_geometry_compression,
GLTF_PT_export_animation,
GLTF_PT_export_animation_export,