Skip to content

Commit

Permalink
Added keep named nodes flag
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptitation committed Dec 16, 2024
1 parent 792535d commit cc8695f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
default=True,
)

export_gltfpack_kn: BoolProperty(
name='Keep Named Nodes',
description='Restrict some optimization to keep named nodes and meshes attached to named nodes so that named nodes can be transformed externally',
default=False,
)

# TODO: some stuff in Textures

# TODO: Animations
Expand Down Expand Up @@ -1269,6 +1275,7 @@ def execute(self, context):
export_settings['gltf_gltfpack_vpi'] = self.export_gltfpack_vpi

export_settings['gltf_gltfpack_noq'] = self.export_gltfpack_noq
export_settings['gltf_gltfpack_kn'] = self.export_gltfpack_kn

export_settings['gltf_binary'] = bytearray()
export_settings['gltf_binaryfilename'] = (
Expand Down Expand Up @@ -1747,7 +1754,7 @@ def export_panel_gltfpack(layout, operator):
# col = body.column(heading = "Scene", align = True)
col = body.column(heading="Miscellaneous", align=True)
col.prop(operator, 'export_gltfpack_noq')

col.prop(operator, 'export_gltfpack_kn')

def export_panel_user_extension(context, layout):
for draw in exporter_extension_layout_draw.values():
Expand Down
2 changes: 2 additions & 0 deletions addons/io_scene_gltf2/blender/exp/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ def __postprocess_with_gltfpack(export_settings):

if (export_settings['gltf_gltfpack_noq']):
options.append("-noq")
if (export_settings['export_gltfpack_kn']):
options.append("-kn")
else:
options.append("-vp")
options.append(f"{export_settings['gltf_gltfpack_vp']}")
Expand Down

0 comments on commit cc8695f

Please sign in to comment.