Skip to content

Commit

Permalink
Add export settings for all materials
Browse files Browse the repository at this point in the history
  • Loading branch information
StidOfficial committed May 29, 2020
1 parent bd4109f commit aa11591
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ def __init__(self):
default=True
)

export_all_materials: BoolProperty(
name='All materials',
description='Export all avalaible materials',
default=False
)

export_colors: BoolProperty(
name='Vertex Colors',
description='Export vertex colors with meshes',
Expand Down Expand Up @@ -432,6 +438,7 @@ def execute(self, context):
export_settings['gltf_draco_mesh_compression'] = False

export_settings['gltf_materials'] = self.export_materials
export_settings['gltf_all_materials'] = self.export_all_materials
export_settings['gltf_colors'] = self.export_colors
export_settings['gltf_cameras'] = self.export_cameras

Expand Down Expand Up @@ -567,6 +574,7 @@ def draw(self, context):
col.prop(operator, 'export_extras')
col.prop(operator, 'export_cameras')
col.prop(operator, 'export_lights')
col.prop(operator, 'export_all_materials')


class GLTF_PT_export_transform(bpy.types.Panel):
Expand Down
5 changes: 3 additions & 2 deletions addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def __gather_gltf(exporter, export_settings):
exporter.add_scene(scene, idx==active_scene_idx)
for animation in animations:
exporter.add_animation(animation)
for material in materials:
exporter.add_material(material)
if export_settings['gltf_all_materials']:
for material in materials:
exporter.add_material(material)

def __create_buffer(exporter, export_settings):
buffer = bytes()
Expand Down

0 comments on commit aa11591

Please sign in to comment.