Skip to content

Commit

Permalink
Merge pull request #310 from Exairnous/support-4.2-import-export-panels
Browse files Browse the repository at this point in the history
Add Blender 4.2+ support for the import/export settings panels
  • Loading branch information
Exairnous authored Oct 19, 2024
2 parents 06d98bf + c9100d6 commit ef9d651
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
24 changes: 24 additions & 0 deletions addons/io_hubs_addon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@
create_prefs_dir()


# Blender 4.2+ glTF Extension Import/Export Settings Panel
def draw(context, layout):
layout_header, layout_body = layout.panel('HBA_PT_Import_Export_Panel', default_closed=True)
sfile = context.space_data
operator = sfile.active_operator

# Panel Header
if operator.bl_idname == "EXPORT_SCENE_OT_gltf":
props = bpy.context.scene.HubsComponentsExtensionProperties
elif operator.bl_idname == "IMPORT_SCENE_OT_gltf":
props = bpy.context.scene.HubsComponentsExtensionImportProperties

layout_header.use_property_split = False
layout_header.prop(props, 'enabled', text="")
layout_header.label(text="Hubs Components")

# Panel Body
if layout_body:
if operator.bl_idname == "EXPORT_SCENE_OT_gltf":
gltf_exporter.HubsGLTFExportPanel.draw_body(context, layout_body)
elif operator.bl_idname == "IMPORT_SCENE_OT_gltf":
gltf_importer.HubsGLTFImportPanel.draw_body(context, layout_body)


def register():
icons.register()
preferences.register()
Expand Down
5 changes: 4 additions & 1 deletion addons/io_hubs_addon/io/gltf_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,10 @@ def draw_header(self, context):
self.layout.prop(props, 'enabled', text="")

def draw(self, context):
layout = self.layout
self.draw_body(context, self.layout)

@staticmethod
def draw_body(context, layout):
layout.use_property_split = True
layout.use_property_decorate = False # No animation.

Expand Down
5 changes: 4 additions & 1 deletion addons/io_hubs_addon/io/gltf_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ def draw_header(self, context):
self.layout.prop(props, 'enabled', text="")

def draw(self, context):
layout = self.layout
self.draw_body(context, self.layout)

@staticmethod
def draw_body(context, layout):
layout.use_property_split = True
layout.use_property_decorate = False # No animation.

Expand Down

0 comments on commit ef9d651

Please sign in to comment.