Skip to content

Instantly share code, notes, and snippets.

@rafaeldelboni
Created April 20, 2026 18:44
Show Gist options
  • Select an option

  • Save rafaeldelboni/0e8f93c551680258889dadaebee85576 to your computer and use it in GitHub Desktop.

Select an option

Save rafaeldelboni/0e8f93c551680258889dadaebee85576 to your computer and use it in GitHub Desktop.
Blender 5.x add-on: clear shadow 'system' custom properties that silently override user custom properties during glTF (.glb) export
bl_info = {
"name": "Clear glTF System Props",
"description": "Remove shadow system custom properties that override user props during glTF export",
"author": "Rafael Delboni",
"version": (1, 0, 0),
"blender": (5, 1, 0),
"location": "View3D > Sidebar (N) > glTF Fix",
"category": "Import-Export",
}
import bpy
class GLTFFIX_OT_clear_system_props(bpy.types.Operator):
bl_idname = "gltf_fix.clear_system_props"
bl_label = "Clear glTF System Props"
bl_description = (
"Delete every system-store custom property on every object in the scene. "
"Use when .glb extras don't match Custom Properties panel values"
)
bl_options = {'REGISTER', 'UNDO'}
selection_only: bpy.props.BoolProperty(
name="Selection only",
description="Only clear on selected objects instead of all objects",
default=False,
)
def execute(self, context):
targets = context.selected_objects if self.selection_only else bpy.data.objects
removed = 0
touched = 0
for o in targets:
sp = o.bl_system_properties_get()
if not sp:
continue
keys = list(sp.keys())
if not keys:
continue
for k in keys:
del sp[k]
removed += 1
touched += 1
self.report(
{'INFO'},
f"Cleared {removed} system prop(s) on {touched} object(s)",
)
return {'FINISHED'}
class GLTFFIX_PT_panel(bpy.types.Panel):
bl_label = "glTF Fix"
bl_idname = "GLTFFIX_PT_panel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "glTF Fix"
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.operator(
GLTFFIX_OT_clear_system_props.bl_idname,
text="Clear All Objects",
icon='TRASH',
).selection_only = False
col.operator(
GLTFFIX_OT_clear_system_props.bl_idname,
text="Clear Selected",
icon='RESTRICT_SELECT_OFF',
).selection_only = True
o = context.object
if o is not None:
sp = o.bl_system_properties_get()
keys = list(sp.keys()) if sp else []
box = layout.box()
box.label(text=f"Active: {o.name}", icon='OBJECT_DATA')
if keys:
box.label(text=f"Shadow props: {len(keys)}", icon='ERROR')
for k in keys:
row = box.row()
row.label(text=f" {k} = {sp[k]!r}")
else:
box.label(text="No shadow props", icon='CHECKMARK')
classes = (GLTFFIX_OT_clear_system_props, GLTFFIX_PT_panel)
def register():
for c in classes:
bpy.utils.register_class(c)
def unregister():
for c in reversed(classes):
bpy.utils.unregister_class(c)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment