diff --git a/addons/io_hubs_addon/__init__.py b/addons/io_hubs_addon/__init__.py index 9856066a..00568392 100644 --- a/addons/io_hubs_addon/__init__.py +++ b/addons/io_hubs_addon/__init__.py @@ -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() diff --git a/addons/io_hubs_addon/io/gltf_exporter.py b/addons/io_hubs_addon/io/gltf_exporter.py index 930fc79e..7b678c1a 100644 --- a/addons/io_hubs_addon/io/gltf_exporter.py +++ b/addons/io_hubs_addon/io/gltf_exporter.py @@ -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. diff --git a/addons/io_hubs_addon/io/gltf_importer.py b/addons/io_hubs_addon/io/gltf_importer.py index 088d0ac8..e0318f39 100644 --- a/addons/io_hubs_addon/io/gltf_importer.py +++ b/addons/io_hubs_addon/io/gltf_importer.py @@ -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.