forked from LeenkxTeam/LNXSDK
Blender 2.8 - 4.5 Support
This commit is contained in:
@ -8,6 +8,24 @@ import mathutils
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
|
||||
# Helper functions for Blender version compatibility
|
||||
def get_panel_options():
|
||||
"""Get panel options compatible with current Blender version."""
|
||||
if bpy.app.version >= (2, 93, 0): # INSTANCED was introduced around 2.93
|
||||
return {'INSTANCED'}
|
||||
else:
|
||||
return set() # Empty set for older versions
|
||||
|
||||
def column_with_heading(layout, heading='', align=False):
|
||||
"""Create a column with optional heading, compatible across Blender versions."""
|
||||
if bpy.app.version >= (2, 92, 0):
|
||||
return layout.column(heading=heading, align=align)
|
||||
else:
|
||||
col = layout.column(align=align)
|
||||
if heading:
|
||||
col.label(text=heading)
|
||||
return col
|
||||
|
||||
from lnx.lightmapper.panels import scene
|
||||
|
||||
import lnx.api
|
||||
@ -939,13 +957,13 @@ class LNX_PT_LeenkxExporterPanel(bpy.types.Panel):
|
||||
col = layout.column()
|
||||
col.prop(wrd, 'lnx_project_icon')
|
||||
|
||||
col = layout.column(heading='Code Output', align=True)
|
||||
col = column_with_heading(layout, 'Code Output', align=True)
|
||||
col.prop(wrd, 'lnx_dce')
|
||||
col.prop(wrd, 'lnx_compiler_inline')
|
||||
col.prop(wrd, 'lnx_minify_js')
|
||||
col.prop(wrd, 'lnx_no_traces')
|
||||
|
||||
col = layout.column(heading='Data', align=True)
|
||||
col = column_with_heading(layout, 'Data', align=True)
|
||||
col.prop(wrd, 'lnx_minimize')
|
||||
col.prop(wrd, 'lnx_optimize_data')
|
||||
col.prop(wrd, 'lnx_asset_compression')
|
||||
@ -1178,32 +1196,32 @@ class LNX_PT_ProjectFlagsPanel(bpy.types.Panel):
|
||||
layout.use_property_decorate = False
|
||||
wrd = bpy.data.worlds['Lnx']
|
||||
|
||||
col = layout.column(heading='Debug', align=True)
|
||||
col = column_with_heading(layout, 'Debug', align=True)
|
||||
col.prop(wrd, 'lnx_verbose_output')
|
||||
col.prop(wrd, 'lnx_cache_build')
|
||||
col.prop(wrd, 'lnx_clear_on_compile')
|
||||
col.prop(wrd, 'lnx_assert_level')
|
||||
col.prop(wrd, 'lnx_assert_quit')
|
||||
|
||||
col = layout.column(heading='Runtime', align=True)
|
||||
col = column_with_heading(layout, 'Runtime', align=True)
|
||||
col.prop(wrd, 'lnx_live_patch')
|
||||
col.prop(wrd, 'lnx_stream_scene')
|
||||
col.prop(wrd, 'lnx_loadscreen')
|
||||
col.prop(wrd, 'lnx_write_config')
|
||||
|
||||
col = layout.column(heading='Renderer', align=True)
|
||||
col = column_with_heading(layout, 'Renderer', align=True)
|
||||
col.prop(wrd, 'lnx_batch_meshes')
|
||||
col.prop(wrd, 'lnx_batch_materials')
|
||||
col.prop(wrd, 'lnx_deinterleaved_buffers')
|
||||
col.prop(wrd, 'lnx_export_tangents')
|
||||
|
||||
col = layout.column(heading='Quality')
|
||||
col = column_with_heading(layout, 'Quality')
|
||||
row = col.row() # To expand below property UI horizontally
|
||||
row.prop(wrd, 'lnx_canvas_img_scaling_quality', expand=True)
|
||||
col.prop(wrd, 'lnx_texture_quality')
|
||||
col.prop(wrd, 'lnx_sound_quality')
|
||||
|
||||
col = layout.column(heading='External Assets')
|
||||
col = column_with_heading(layout, 'External Assets')
|
||||
col.prop(wrd, 'lnx_copy_override')
|
||||
col.operator('lnx.copy_to_bundled', icon='IMAGE_DATA')
|
||||
|
||||
@ -1517,7 +1535,7 @@ class LNX_PT_TopbarPanel(bpy.types.Panel):
|
||||
bl_label = "Leenkx Player"
|
||||
bl_space_type = "VIEW_3D"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_options = {'INSTANCED'}
|
||||
bl_options = get_panel_options()
|
||||
|
||||
def draw_header(self, context):
|
||||
row = self.layout.row(align=True)
|
||||
@ -2921,7 +2939,7 @@ def draw_conditional_prop(layout: bpy.types.UILayout, heading: str, data: bpy.ty
|
||||
"""Draws a property row with a checkbox that enables a value field.
|
||||
The function fails when prop_condition is not a boolean property.
|
||||
"""
|
||||
col = layout.column(heading=heading)
|
||||
col = column_with_heading(layout, heading)
|
||||
row = col.row()
|
||||
row.prop(data, prop_condition, text='')
|
||||
sub = row.row()
|
||||
|
Reference in New Issue
Block a user