This commit is contained in:
2026-02-24 17:35:26 -08:00
parent 1c3c30e6ce
commit d45c632dcd
28 changed files with 1982 additions and 97 deletions

View File

@ -595,6 +595,20 @@ class LeenkxExporter:
return space.region_3d.window_matrix, space.region_3d.is_perspective
return None, False
@staticmethod
def get_viewport_lens_fov() -> Optional[float]:
"""Get FOV from viewport lens setting."""
play_area = LeenkxExporter.get_view3d_area()
if play_area is None:
return None
for space in play_area.spaces:
if space.type == 'VIEW_3D':
lens = space.lens
sensor = 32.0
fov = 2.0 * math.atan(sensor / (2.0 * lens))
return fov
return None
def write_bone_matrices(self, scene, action):
# profile_time = time.time()
begin_frame, end_frame = int(action.frame_range[0]), int(action.frame_range[1])
@ -2785,7 +2799,7 @@ class LeenkxExporter:
wrd = bpy.data.worlds['Lnx']
phys_enabled = wrd.lnx_physics != 'Disabled'
phys_pkg = 'bullet' if wrd.lnx_physics_engine == 'Bullet' else 'oimo'
phys_pkg = 'bullet' if wrd.lnx_physics_engine == 'Bullet' else ('jolt' if wrd.lnx_physics_engine == 'Jolt' else 'oimo')
# Rigid body trait
if bobject.rigid_body is not None and phys_enabled:
@ -3099,7 +3113,7 @@ class LeenkxExporter:
if wrd.lnx_physics != 'Disabled' and LeenkxExporter.export_physics:
if 'traits' not in self.output:
self.output['traits'] = []
phys_pkg = 'bullet' if wrd.lnx_physics_engine == 'Bullet' else 'oimo'
phys_pkg = 'bullet' if wrd.lnx_physics_engine == 'Bullet' else ('jolt' if wrd.lnx_physics_engine == 'Jolt' else 'oimo')
out_trait = {
'type': 'Script',
@ -3204,7 +3218,7 @@ class LeenkxExporter:
LeenkxExporter.export_physics = True
assets.add_khafile_def('lnx_physics_soft')
phys_pkg = 'bullet' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Bullet' else 'oimo'
phys_pkg = 'bullet' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Bullet' else ('jolt' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Jolt' else 'oimo')
out_trait = {'type': 'Script', 'class_name': 'leenkx.trait.physics.' + phys_pkg + '.SoftBody'}
# ClothModifier
if modifier.type == 'CLOTH':
@ -3228,7 +3242,7 @@ class LeenkxExporter:
def add_hook_mod(o, bobject: bpy.types.Object, target_name, group_name):
LeenkxExporter.export_physics = True
phys_pkg = 'bullet' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Bullet' else 'oimo'
phys_pkg = 'bullet' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Bullet' else ('jolt' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Jolt' else 'oimo')
out_trait = {'type': 'Script', 'class_name': 'leenkx.trait.physics.' + phys_pkg + '.PhysicsHook'}
verts = []
@ -3254,7 +3268,7 @@ class LeenkxExporter:
return
LeenkxExporter.export_physics = True
phys_pkg = 'bullet' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Bullet' else 'oimo'
phys_pkg = 'bullet' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Bullet' else ('jolt' if bpy.data.worlds['Lnx'].lnx_physics_engine == 'Jolt' else 'oimo')
breaking_threshold = rbc.breaking_threshold if rbc.use_breaking else 0
trait = {