Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Blender 4.2+ support for the import/export settings panels #310

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading