Jump to content
  • entries
    12
  • comments
    636
  • views
    10,901

The Effin Export/Import Project


Bad Dog

9,058 views

Edit: For the record, this tool is implemented and has its own thread here: 

 

I can't really do what I want to do with FO4 if I can't do proper weight painting and I don't have full control over the nifs I create. So I've decided to have a look at making proper import/export tools between Blender and FO4. I'm using this blog to track thoughts and progress notes along the way.

 

There are two possible routes:

  1. Extend the niftools package. That is currently being actively worked on, tho there was a long hiatus for the past few years, which meant I was stuck with old versions of Blender and a multi-step conversion process. The recent versions support the latest Blender and maybe have better export--I haven't yet seen a version which exports properly but I haven't tested the latest. Upside of this method is it ties into an existing project and extends the tools that have been around forever. Downside is this stack is very complicated--translation generated from XML files, read/write through pyffi, and so forth. I'm told the XML for FO4 has been written but pyffi needs updating to use it. Presumably higher levels of the stack would need work too? Dunno. 
  2. Bodyslide/OS has export/import to all games and they stay up to date all the time. Their nif code is cleanly separated into a package called Nifly, which is used by BS/OS, Cathedral tools, and Nif Optimizer. So it seems like robust code with an active community behind it. Downside is I'd have to access it from a Blender python addon, and I have to figure out how to walk the Blender representation of a model so as to push it at Nifly.

 

I've looked a little bit at both options. My feeling right now is that the hard part of the niftools route is digging into XML, generated code, and pyffi. The hard part of the Nifly route is figuring out how to bolt it into Blender and parse the Blender data model. That seems more straightforward. It's all known stuff--Blender addons and such. So until I hit a roadblock, I'm going to explore that.

 

The biggest issue is whether I can call the C++ Nifly code from a Blender addon. I hunted through other addons and found an import/export addon that does exactly that. So in theory I just copy their method.

 

So here's the project:

  1. Figure out how to make a Blender export/import addon
  2. Figure out how to make a DLL
  3. Make a dummy DLL and call it from a dummy export/import addon. Once that's done I know I can get data into and out of Blender.
  4. Make a DLL encapsulating Nifly
  5. Call that DLL from my Blender addon. 
  6. Keep adding features until done.

 

#1 is mostly done--I have a little script that pretends to be an export/import addon but does nothing. On to #2.

Edited by Bad Dog

175 Comments


Recommended Comments



Whoops, my bad on two count. One is it's @DexesTTP, not HTTP, and the other is that the tool eats Collada (DAE) files rather than FBX (which probably explains why my last attempt with it didn't go very far.

 

But yeah, we have the makings of a Blender->hkx pipeline here.

Link to comment

Okay,  @DocClox, new release up at the github. This hooks up the bones into a skeleton, getting bones from the reference skeleton as needed. It also orients Skyrim bones along the line of the skeleton.

 

Link to comment

I'm not seeing any connection here. Bones move independent of each other, and I can't see any of the  little dotted lines that usually connect linked bones.

 

I'll double check that the old version uninstalled properly and that I did in fact install the new one.

 

[edit]

 

Version 0.0.9 is the one I just used according to Blender, so it's the old one. I'll re-download, just in case I did something idiotic like click the wrong link.

Link to comment

OK. I think the problem there was the uninstaller bailed because it couldn't remove the Nifly dll on account of it being open in Blender. I quiit Blender and did a manual remove and the install worked after that.

 

Some bones are linked. The toes are joined to the feet and the spinal column seems to work as expected. Most of the rest are as before

 

[edit]

 

I don't know if it's useful or relevant, but I tried importing from skeleton.nif and I end up importing an empty collection.

 

[edit]

 

There's also possibly some bones missing entirely. I'd expect to find a Pelvis or COM bone there somewhere, but I can't find it. |This might explain why the linkage chains are broken for the lower body. And there are thigh skin bones, but no LLeg_Thigh which would move the actual thigh.

Link to comment
1 hour ago, DocClox said:

OK. I think the problem there was the uninstaller bailed because it couldn't remove the Nifly dll on account of it being open in Blender. I quiit Blender and did a manual remove and the install worked after that.

Durr, that's a thing and I'm not sure how to deal with it. I have to watch for it on my machine but that's with the dev account. Might be able to do a late-loading thing where it doesn't connect the DLL until you actually use it.

 

All the bones should be linked, that I know about. Send me your nif if not.

 

You should have a pelvis bone, it's certainly in the skeleton. Dunno about the COM bone, I pruned some of the XPMSE bones and maybe got over-enthusiastic? I'll look. This is FO4, right?

 

Yeah, I have to explicitly enable importing skeletons with no mesh. Right now it expects a shape and then imports bones the shape uses.

 

EDIT: Okay, I see what you're seeing, just on the vanilla body. On a hunt now.

Link to comment

Yeah, FemaleBody.nif, probably from Fusion Girl, but I can't remember exactly and I have unpacked meshes from vanilla, CBBE and FG so it coudl be any of 'em.

 

And yeah, FO4.

Link to comment

Just wanna say that I fucking love what you do. You single handedly made me hard for Skyrim, and your dedication to digitrade and anatomical dongus is very appreciated. Thank you.

Link to comment

LOL. And here I was just thinking I didn't need to bother with digitigrade or anatomical dongus on FO4.

 

@DocClox got a new version up for you. I think it's giving you a full skeleton now. I did a late load of the DLL, so if you start a new session and *don't* import, you should be able to upgrade.

 

I'm noticing the female body's "breast skin" bones don't appear to be weighted to anything. They're also oddly placed. That seems wrong. Let me know what you think.

 

Edit: well... maybe it is weighted. Dunno what I was looking at.

Link to comment

OK. Downloading now

 

[edit]

 

Uninstall is still borked, of course. Fix won't apply until the new version is installed. Got the new version in now...

 

Upper body looks better. There's a Spine2 bone now, I was wondering where that went. Still no Com or Pelvis bones though, and the lower body is  still largely unlinked.

 

image.png

 

If it'll help, I can probably pull a list of bones out from @ShadeAnimator's F4AK.

 

 

[edit]

 

If I grab one of those skin bones and drag it, the skin deforms along with it, so the mesh does appear to be weighted to them.

 

Link to comment

goddammit, dude. How can that be. I know I fixed this. And I checked the CBBE body.

 

I wonder. I know. I bet it has to do with not finding the reference skeleton. Maybe. I might not be *shipping* the reference skeleton. In fact I'm not sure if I should do that or if I should look for the game directory and get it from there. 

 

Not incidentally one of the things I have to do before releasing this generally is better error reporting.

 

As for install, do you have to uninstall? What should work is: Shut down all blender windows; open a fresh blender window; go to the addons window; install. No uninstall or anything.

 

(There *is* wonkiness with uninstall that I haven't worked out, but the above workflow should be fine.)

Link to comment
1 hour ago, Bad Dog said:

I wonder. I know. I bet it has to do with not finding the reference skeleton. Maybe. I might not be *shipping* the reference skeleton. In fact I'm not sure if I should do that or if I should look for the game directory and get it from there. 

 

That's why I was trying to import skeleton.nif. I used that in Skyrim to make a serviceable animation, and loaded a weighted mesh onto it to check that it looked ok with skin on the bones. But if I load that in Fo4, I have to go Max->FBX->Blender and then the bone rotation is all wrong. But as I say, I try that with your importer and I don't get any bones at all. Possibly because none of 'em are linked to skin, which might be a clue.

 

1 hour ago, Bad Dog said:

As for install, do you have to uninstall?

 

No, not really. I was just trying to be thorough :)

 

I'll install the next version over the old one if that's the recommended approach.

Link to comment

Okay, once again with feeling. I was totally not shipping skeletons and had a quick and dirty way of finding them, which was never intended to be permanent. Both issues now fixed, and I tested on a different machine to make sure it works as it should.

 

Pretty sure you can just launch blender and install the new version. If it says you have 0.0.14 you're good. If you import something then try to upgrade, it won't work.

 

@DocClox

Link to comment

Well, it's definitely getting there :)

 

image.png

 

Not sure about those boobs though.

 

image.png

 

Should some of those skin bones perhaps move with the main armature?

 

 

 

Link to comment

Yes?

 

Which bones are they? 

 

There's something very odd about the weighting--it's like it needs to be smoothed. When it stretches it sort of crinkles instead of stretching smoothly.

 

Edit: My skin bones are def all connected up. Are those the breast skin bones?

Link to comment
17 minutes ago, Bad Dog said:

Which bones are they? 

 

I don't know, alas. I'm still struggling to understand a lot about this animation business. I hod the body mesh so I could compare the bone layout against Max and while I haven't had a chance to be systematic they look OK at first glance.

 

It's as if something's being translated, but needs to be rotated as well. I did wonder about those rib helper bones (I can't find any "boob" or "breast" bones) which seem oddly oriented, but they seem to rotate as I'd expect.

 

I'll check it over some more a bit later.

 

Link to comment

OK. One possible culprit is the "CLOTH_Bone_Googles_*" bones.  They don't appear to move with the spine, and if I rotate them just right I can undo the deformation of the breasts. They're apparently not linked to anything, but they're clearly strongly weighted to the boobs. I'm not sure if "CLOTH" here is a euphemism for "boob", or if they're not supposed to be weighted to the skin in the first place.

 

I haven't found anything for the hip distortion yet. There might not be anything, it might just be an extreme pose showing the limits of the skeleton and mesh. I'll have another look tomorrow when I'm a bit more awake.

Link to comment
43 minutes ago, DocClox said:

OK. One possible culprit is the "CLOTH_Bone_Googles_*" bones.  They don't appear to move with the spine, and if I rotate them just right I can undo the deformation of the breasts. They're apparently not linked to anything, but they're clearly strongly weighted to the boobs. I'm not sure if "CLOTH" here is a euphemism for "boob", or if they're not supposed to be weighted to the skin in the first place.

Sounds like that's one of the body meshes that weighted the breasts to the neck goggle bones from Sturges' overalls to hijack the latter's cloth physics and stand in as a poor man's boob physics.

 

That mesh layout is OLD AS FUCK and was rendered obsolete the very second (O)CBP(C) came to be, since the latter uses the vanilla "Breast" skin bones and simply applies physics to them. So try using a more recent body mesh or maybe just one that doesn't have "Physics" in the name (which doesn't mean it won't have physics, but rather that it doesn't use the cloth physics workaround. Which is good, since we don't want crappy-ass cloth physics on the breasts).

Link to comment

Ya, I don't know what "googles" are so I can't link them up to the armature. If they're linked in the nif I give it a try, so I'm guessing they aren't. If that's the case there's not anything I can do. (Except put these in the reference skeleton, but based on what Blaze sez, maybe better not.

 

I think the hip distortion is just what you're getting with that body.

 

Link to comment
8 hours ago, Blaze69 said:

That mesh layout is OLD AS FUCK and was rendered obsolete the very second (O)CBP(C) came to be, since the latter uses the vanilla "Breast" skin bones and simply applies physics to them.

 

Yeah, I grabbed a body mesh at random (figuring it wouldn't much matter) and I think this one came from my dev folder, back when I was looking for a mesh for my first set of Fo4 tats. So it could be a year or more old, quite easily.

 

8 hours ago, Blaze69 said:

So try using a more recent body mesh

 

Yeah yeah yeah. Like I say, I picked one at random because who knew to expect weird bone weights, right?

 

Anyway - good call. This is the same pose using ZeX and Fusion Girl

 

image.png

 

4 hours ago, Bad Dog said:

I think the hip distortion is just what you're getting with that body.

 

Yeah, looks like you're right. Here's the same pose in Max and the distortion is about the same. Which is to say minimal with an up-to-date body mesh.

 

image.png

 

Looks like we may have a result. I'll have to try animating something now and see if I can get it in game :)

 

 

Link to comment

Trying to make an actual animation  by way of a test. First of all, I'll need a head to go with the body.

 

Nifly Import
..Importing FO4 file
..Connecting armature
A L   l i b :   ( E E )   F a i l e d   t o   g e t   p a d d i n g :   0 x 8 8 8 9 0 0 0 4
 Nifly Import
Python: Traceback (most recent call last):
  File "C:\Users\nick\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\io_scene_nifly\__init__.py", line 396, in execute
    import_file(f)
  File "C:\Users\nick\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\io_scene_nifly\__init__.py", line 361, in import_file
    print("..Importing " + f.game + " file")
  File "C:\Users\nick\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\io_scene_nifly\pynifly.py", line 695, in game
    self.dict = gameSkeletons[self._game]
KeyError: ''

location: <unknown location>:-1

 

Same problem with the back of the head. Which seems surprising. And in fact, if I start a new bender session and import it, it imports just fine. So I there may be a problem with importing more than one mesh per session.

 

On a related note: Anyone have any thoughts on merging skeletons?

 

[edit]

 

OK: All three body parts import fine if they're the only thing I try to import. Then I can copy-past from one instance to another and get a body with a head. Bones are a bit trickier though.  Both head parts have a COM bone, and replicate the skeleton up to the spine and the neck, after which they do their own thing. I might try deleting duplicate bones in the head armatures and then joining the result up and reconnecting the bones manually.

 

[edit]

 

OK, that should work. I deleted everything below neck from the face mesh and parented the neck to the body chest bone, choosing "keep offset". TGhe re-parented the face mesh to the armature and it all seems to move as expected. I'll do the back of the head the same way and then see if I can do something practical with the result.

 

[edit]

 

Body and two head parts, all posed decently enough. It's ungainly, but it demonstrates that the head and neck are integrated with the body.

 

[edit]

 

This is the item I've been playing with for Raider Reform School. Previously, I was posing the mesh in Max, then exporting the static body to Blender, making restraints, then copying them back to Max to adjust the pose. It wasn't working well.

 

Anyway, this is a nifly exported body in the new restraint.

 

 

 

So animation works. Next trick is to get this in-game. Which may yet prove easier said than done.

 

 

Link to comment

I may have let myself get carried away with my own enthusiasm. I can't find a download for HKXAnim anywhere. There's a github page, but that just has a licence and readme file. Damn.

Link to comment

Argh, bummer. 

 

Dunno what the problem with importing more than one thing at a time is. I know the tests do that. I'll see if I can reproduce. I

 

Merging skeletons is an interesting problem. Howabout this: If you have a skeleton selected when you import, the new mesh gets parented to the skeleton, and any bones in the nif but not in the skeleton get added and hooked in if we can figure out how. Sound reasonable?

 

Also I'll figure out importing the skeleton only.

Link to comment

That sounds like it should work.

 

I'm going to try and import that anim into Max so I can use HCT to export it. If I can just do the pose and modelling both in Blender, that'll still be tremendously useful.

Link to comment

Got tri export/import working, 90%. Export a mesh and the shape keys export with it. Import a tri and it will either be created as its own shape or, if you have a shape selected with the same number of verts, it will import the morphs into that object. 

 

The 10% is there's a path that scrambles the UVs that I haven't figured out yet.

 

Once this is good I can clean up the lykaios heads.

Link to comment

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use