Kenshi
Tangentric Mar 12, 2019 @ 11:36pm
Errors from Blender when exporting skeleton and animations - please halp?
Hi everyone!
I decided to take the plunge and change the ninjarun animation to be .. less handwavium. Have never used animation tools before, but the support for Blender looked pretty tight and I've succeeded at least in getting the animation I want.. which I very much prefer over the standard ninjarun.

Started with the base game male skeleton and saved as new and played around. Figured if I used the original models I shouldn't have to play with meshes, UV, etc, as I'm only a newb to this. I did not start with the template human.

So now comes the upsetting part. Whenever I export to mesh with *both* Export Skeleton and Export Animation ticked, I get the following error:

-----------------------
Traceback (most recent call last):

File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_mesh_Kenshi\__init__.py", line 337, in execute
result = OgreExport.save(self, context, **keywords)

File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_mesh_Kenshi\OgreExport.py", line 1064, in save
xSaveSkeletonData(blenderMeshData, filepath)

File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_mesh_Kenshi\OgreExport.py", line 593, in xSaveSkeletonData
xSaveAnimations(blenderMeshData, xRoot, xDoc)

File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_mesh_Kenshi\OgreExport.py", line 330, in xSaveAnimations
xSaveAnimation(animation, xDoc, animations)

File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_mesh_Kenshi\OgreExport.py", line 382, in xSaveAnimation
scale.setAttribute('x', '%6f' % -loc[0])
UnboundLocalError: local variable 'loc' referenced before assignment

location: <unknown location>:-1
-----------------------


Do any more experienced Blender/modders have any idea what I can do to resolve this?

Eternal gratitude will absolutely be given.

TIA!
Last edited by Tangentric; Mar 12, 2019 @ 11:36pm
< >
Showing 1-12 of 12 comments
oi__io Mar 12, 2019 @ 11:47pm 
Originally posted by Tangentric:
Started with the base game male skeleton and saved as new and played around.
I have several questions:
1. Did you refer to this guide on animation modding[www.lofigames.com] made by the dev?

2. When you say base game male skeleton, did you mean the one in "data/character/meshes/male_skeleton/" and if you are, did you import existing animation or did you start completely from scratch?

3. Which version of Kenshi Blender import/export plugin are you using? The latest is 0.8.11[www.lofigames.com]

4. Did you add any extra bones to the skeleton? Other than posing it, did you make any other changes to the skeletons?
Tangentric Mar 13, 2019 @ 4:06am 
Hiya oi__io!

Firstly, love your work - from what I've seen, you're a king among men in the modding community.

1. Yep, absolutely read everything I could about Kenshi modding before I started. I haven't read much about the Blender program itself. It *sounded* so easy at the start. Steep learning curve!

2. Yeah, I imported the one from the game male_skeleton directory, not using the provided downloable template from lofigames. I imported all the existing animations then deleted all the animations except ninjarun, which is what I wanted to change. All I've done is rotate the arms and hands to be less... flappy.. imo.

3. Using the latest plugin - downloaded a couple of days ago: Blender Plugin 0.8.11

4. I didn't change any of the skeleton except for rotating, at least, I don't think I did. Maybe I stretched or moved a bone without realising it but whenever something happened that I didn't want I'm pretty sure I Ctrl-Z'd it back. I certainly haven't deleted or added any bones. Would stretching a bone screw something up?
oi__io Mar 13, 2019 @ 8:09am 
Thanks for the kind words but I'm not that good. I don't know much about NLA animation in Blender since I haven't spent a lot of time looking into it so I don't even know if I can help you but I'll try.

Rotating or moving the bones in Pose Mode should be perfectly fine since that's part of the animation process. However rotating, moving or stretching it in Edit Mode could cause problem.

If you're unsure about whether you've made any changes to the bones other than in Pose Mode, perhaps you should try again from the beginning.

Also, what did you select for export? Did you select the body mesh or the bones itself? If I'm not mistaken if you want to export skeleton and animation, you must select only the mesh. By selecting the options to export skeleton and animation in the export menu, both of those will be exported along with the mesh.

I haven't tested this myself but perhaps you should even parent the mesh to the skeleton before exporting, then select the mesh only in Object Mode and try exporting. Of course this is only a guess since I have never tried modding animation before so I don't even know if this is necessary.
Tangentric Mar 13, 2019 @ 8:10am 
Yeah, I don't know what's going on .. I started again from the base male skeleton and tried to position the arm but every time I changed the frame it lost all my changes from the previous frame. Tried propagating, copy/pasting, using keyframes, etc, and nothing. Not a single change to any pose would stick.

Tried resetting the Rest position but it screwed up everything.

Tried uninstalling and reinstalling Blender, re-downloading the Blender Plugin, starting everything again, again, and I can't affect any changes on any of the animations, and I tried many.

It was a nice idea to have a go at the most basic of animation changes but if it takes days of effort to turn a hand and kink an elbow... and even when I did do changes the animation won't export... ugh, I guess it's just one more lost amateur modder.

Shame. This looked like it could be fun.
oi__io Mar 13, 2019 @ 2:46pm 
One of the main reason why I haven't tried modding Kenshi animation is due to the lack of documentation surrounding it. Not a lot of existing modders have experience with it and those who do have experience are not interested in making a guide to share with us how to make it work.

So, if I wanted to try my hands at animation, I'll have to spend a chunk of my time learning everything from scratch since I know very little about it and a lot of hours will go into experimenting with a lot of trial and error.

I decided not to do that considering I have so many projects currently on hold while at the same time I'm also hoping that one day someone will be kind enough to share their workflow in making Kenshi animation.

I know how much it sucks when you wanted to make something but it doesn't work even after you've spent a chunk of your time working on it. I hope someone with experience with animation will see this post and offer their help.

Should one day you find a solution to your problem, please share with us how you go about solving it so that we all can learn from it.
Tangentric Mar 13, 2019 @ 6:33pm 
So I tried exactly the same stuff this morning as yesterday, and this time it's working. I *think* I have the skeleton animation exported correctly (it imports back into Blender with the right animation). I don't know why this time it worked.

Now I just have to import it into FCS and see if I can get it into the game :D .. reinvigorated!
Tangentric Mar 13, 2019 @ 7:23pm 
Heh, it imported okay but it's like the orientation is off - the character faceplants the ground and has their legs kicking up in the air behind them. This is still progress, will keep butting heads with it.
Tangentric Mar 14, 2019 @ 6:58am 
Yay! worked it out! Just had to play with FCS settings "overrides" and "track exclusion" in the Animation for run upper stealth, and badabing! Working animation :D
Morkonan Mar 14, 2019 @ 8:02am 
Originally posted by oi__io:
...So, if I wanted to try my hands at animation, I'll have to spend a chunk of my time learning everything from scratch since I know very little about it and a lot of hours will go into experimenting with a lot of trial and error....

I don't know anything about Ogre3D animation files, but in general "animation" isn't that difficult. "Good Animation" is..

But, there are fifty-eleven free BVH mocap files out there with all sorts of animations in them so you don't have to do everything by hand The key is, of course, having a very good animation editor to reassign rigging bones as needed and an engine that will happily accept them and compensate for everything that isn't in the animation file. (Keep the character on the ground, etc.)

I used to have a nice stand-alone bit of software a guy wrote for Second-Life animation editing. Can't remember the darn name of it, but it was really nice for what it did.

However, Blender should have tools like that in it, so it shouldn't be that big of a deal to get in an additional animation. Your first stop should be the Ogre3D forums and tutes. Go out and grab a few free BVH animation files that are suitable from wherever. I'm sure there are some martial arts/sword-swinging/etc mocapped animations out there that would be perfect for Kenshi additions.

Free BVH mocapped animations from CMU - http://mocap.cs.cmu.edu
Ogre3D Animation and Movement - http://wiki.ogre3d.org/Animation+and+Movement
Editing Animations in Bledner - https://docs.blender.org/manual/en/latest/animation/index.html#

Enjoy!
Last edited by Morkonan; Mar 14, 2019 @ 8:03am
oi__io Mar 14, 2019 @ 10:50am 
Originally posted by Tangentric:
Yay! worked it out! Just had to play with FCS settings "overrides" and "track exclusion" in the Animation for run upper stealth, and badabing! Working animation :D
Congrats on successfully modding the animation. I hope you'll consider documenting your process so others can learn from it.

By the way, the dev responded to another post which shares the exact error message as your original post up top. Apparently there's issues with the plugin.
Originally posted by someone:
Plugin v0.8.12 fixes this crash.
or delete the scale key frames.
Tangentric Mar 14, 2019 @ 7:32pm 
Brilliant - a new plugin! Great news! That makes sense too as I was using Loc/Rot/Scale keyframes the first time around, whereas for the working one I used just Location and Rotation keyframes.

Hit another issue where in-game skeletons (ie robots) don't play the animation when sneaking at high speed (when they should use ninjarun). I think I should be able to figure this out though. Guessing that skeletons may have their own .skeleton file, or maybe this skele's from a mod with their own race.

A weird one is that I have one named (ie FCS Character) Shek female that plays the animation fine, but another generic Shek female that doesn't. AFAIK that shouldn't happen.
Tangentric Mar 14, 2019 @ 8:33pm 
Alright.. fundamental problem found. If I add a new ninjarun animation in a new skeleton file, called eg "notninjarun", then any new races from others' mods don't get that animation. But not only that, it doesn't play an animation for the race and they have the base stand-up-straight pose.

With no fallback/default for individual animations, adding a new movement animation is near to impossible. Instead, you have to replace the original .skeleton files within your mod with all of the original animations still intact (rather than deleting them as suggested by the dev). This is a problem because if multiple mods have the full animation file in their structure, only the last mod on the list will have active animations.

TLDR; can't add new animations with new skeleton files for generic animations due to FCS mods allowing for new races.

Is there a way around this that anyone knows of?

< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Mar 12, 2019 @ 11:36pm
Posts: 12