Resource icon

Misc Blender ksanim/knh exporter 0.4

Login or Register an account to download this content
My script doesn't account for the rotation that the fbx exporter does at the root level. The part that's set as "forward: -z forward. up: y up". Cause I would have to copy that entire section of the fbx exporter's settings, and then users would need to manually match them anyway.

Instead it just can't be used on top level objects. Anything animated needs a parent. Doing this (any convenient rotation on the parent) will work.
I see. I thought I had to animate on the empty of the HUB, and that's why I did have that issue, then. I've caster, so I really need the HUB to be tilted how I want.
I can add parents anywhere I want?

At the end I've worked the issue around. Now I export in FBX, with the export settings attached it will export multiple objects animations correctly.
I've taken inspiration from export settings for Unreal Engine that I've seen on the web.
Of course then I've to use ksEditor everytime.
 

Attachments

  • Screenshot 2023-05-04 201021.png
    Screenshot 2023-05-04 201021.png
    65.3 KB · Views: 56
Last edited:
hi, I need help cause i installed the plugin and the export .ksanim isnt there, i tried at least 5 blender versions but didnt work
Same issue. I'm working on my first car mod, and it's a huge learning experience. It sucks to be this far along that I'm ready to animate the driver, but I can't export the animations from Blender. I'm using Blender 3.2.
 
I use 3.2.0 as well so it should be fine, the install process is:
rekYIUM.png

Click "Install" and find the downloaded package.
Search for the plugin
Make sure it's enabled with the checkmark.
 
The add-on is installed, but in the File>export> drop-down menu there is no option to export to assetto corsa .knh or .ksanim. Am I missing something?
 
I think it might be a conflict with another add-on, but it will take some time to troubleshoot. If I find a solution, I'll be sure and post it here.
 
If anyone else is using Blender 3.6 or newer and/or having issues with animations being rotated 90 degrees

You'll need to install Blender 3.3 and this add-on on it. To export from the newer Blender version select the animation empties only and export them to FBX with animation enabled. If you're having issues with it taking too long to export try disabling everything under Animation such as Key All Bones, NLA Strips, etc.

You should be able to import this FBX into Blender 3.3 and export it as .ksanim using this add-on, don't forget to increase the Frame Range End to the amount you're using. But if you're having issues with 90 degree rotation you'll need to edit the add-on source code.

Go to your Blender 3.3 add-ons folder (%appdata%\Blender Foundation\Blender\3.3\scripts\addons\), io_export_ksanim folder and edit ksanimfile.py.

Change
---
if obj.rotation_mode != "QUATERNION":
rotation = list(obj.matrix_parent_inverse.to_quaternion() @ obj.rotation_euler.to_quaternion())
else:
rotation = list(obj.rotation_quaternion)
---

To
---
quat_90 = mathutils.Quaternion((1, 0, 0), math.radians(-90))

if obj.rotation_mode != "QUATERNION":
rotation = list((obj.matrix_parent_inverse.to_quaternion() @ quat_90) @ obj.rotation_euler.to_quaternion())
else:
rotation = list(obj.rotation_quaternion @ quat_90)
---

You should be able to export animations with proper rotation (after relaunching Blender) just like how ksEditor does it but without being limited to 100 keyframes.

I know the post for this add-on says to just rotate the EMPTYs but I found that doesn't work properly with a lot of animation types in Blender.
 
Last edited:
If anyone else is using Blender 3.6 or newer and/or having issues with animations being rotated 90 degrees

You'll need to install Blender 3.3 and this add-on on it. To export from the newer Blender version select the animation empties only and export them to FBX with animation enabled. If you're having issues with it taking too long to export try disabling everything under Animation such as Key All Bones, NLA Strips, etc.

You should be able to import this FBX into Blender 3.3 and export it as .ksanim using this add-on, don't forget to increase the Frame Range End to the amount you're using. But if you're having issues with 90 degree rotation you'll need to edit the add-on source code.

Go to your Blender 3.3 add-ons folder (%appdata%\Blender Foundation\Blender\3.3\scripts\addons\), io_export_ksanim folder and edit ksanimfile.py.

Change
---
if obj.rotation_mode != "QUATERNION":
rotation = list(obj.matrix_parent_inverse.to_quaternion() @ obj.rotation_euler.to_quaternion())
else:
rotation = list(obj.rotation_quaternion)
---

To
---
quat_90 = mathutils.Quaternion((1, 0, 0), math.radians(-90))

if obj.rotation_mode != "QUATERNION":
rotation = list((obj.matrix_parent_inverse.to_quaternion() @ quat_90) @ obj.rotation_euler.to_quaternion())
else:
rotation = list(obj.rotation_quaternion @ quat_90)
---

You should be able to export animations with proper rotation (after relaunching Blender) just like how ksEditor does it but without being limited to 100 keyframes.

I know the post for this add-on says to just rotate the EMPTYs but I found that doesn't work properly with a lot of animation types in Blender.
I think i noticed issues yeah. I'm still using blender 3.5 for that
 
quat_90 = mathutils.Quaternion((1, 0, 0), math.radians(-90))

if obj.rotation_mode != "QUATERNION":
rotation = list((obj.matrix_parent_inverse.to_quaternion() @ quat_90) @ obj.rotation_euler.to_quaternion())
else:
rotation = list(obj.rotation_quaternion @ quat_90)
Yeah I have to be an idiot because I followed this and got expected and indented block when reactivating the plugin.
 
Last edited:
Back
Top