Blender 2.71 - Importer / Exporter (1.4.4)

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Blender 2.71 - Importer / Exporter (1.4.4)

Post by bitcpy »

Add on page
https://sites.google.com/site/bitcpy

Latest Version 1.4.4
https://sites.google.com/site/bitcpy/do ... sion-1.4.4

Version 1.4.3
https://sites.google.com/site/bitcpy/do ... sion-1.4.3

Version 1.4.2
https://sites.google.com/site/bitcpy/do ... sion-1.4.2

Version 1.4.1
https://sites.google.com/site/bitcpy/do ... sion-1.4.1

Version 1.4
https://sites.google.com/site/bitcpy/do ... ersion-1.4

Version 1.3.2
https://sites.google.com/site/bitcpy/do ... sion-1.3.2

Version 1.3.1
https://sites.google.com/site/bitcpy/do ... sion-1.3.1

Importer 1.3
http://pastebin.com/8d80g7AX

Importer 1.2
http://pastebin.com/u0xi57yy

Original post:
I wanted to look at some models from LoG2 today, so I wrote a simple rigid importer for Blender.
If anyone is interested I uploaded a pastebin of it.

You can load models directly from the .dat container or stand-alone .models.
Most of the models I looked at used the same format as LoG1, so it's basically the same importer I did for LoG1 way back except this one actually reads model according to the LoG1 documentation.
I didn't bother with applying materials or setting up the node transform chains, so you could probably expect some models to be huge or slightly out of place.

Anyways, if anyone is interested you can find the paste-bin at the line below.
http://pastebin.com/5S0a32FL
Last edited by bitcpy on Sat Jan 24, 2015 1:11 am, edited 12 times in total.
User avatar
Leki
Posts: 550
Joined: Wed Sep 12, 2012 3:49 pm

Re: Blender 2.71 - Model Importer

Post by Leki »

Works fine, well done!
Maybe you can improve it in the future to load bones etc ;)
I'm the Gate I'm the Key.
Dawn of Lore
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Blender 2.71 - Model Importer

Post by AdrTru »

I had some problems with instaling this script ( my errors :) ), but now it working.

As Leki wrote, the bones will be wery usefull.
( when I made a program for model of LOG1 manipulation I didnt able to applicate inversion vector for bone :( - its nessesary for monster )

Thank you for your work.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
User avatar
germanny
Posts: 530
Joined: Sat Apr 07, 2012 10:52 pm
Location: Kiel, Germany

Re: Blender 2.71 - Model Importer

Post by germanny »

Works very well. Thanks a lot!
Hey bitcpy, it seems you are skilled in blender scripting.
Would it possible for you to do an exporter to grimrock model format?
And animation data with it?

Much more work, i guess.. but it would be a huge step for the community here and for blender^^
Dungeon Master Resource Pack worker and passionated Beer drinker
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Model Importer

Post by bitcpy »

I guess, shouldn't really be a problem.

Actually gave the node structure, skinning and bone setup a test yesterday.
As well as loading animations and keying them up in blender.

Nodes are correct, and skinning seems about right.
I 'think' the rest pose is correct, but that's just assuming bone- to model-space means there aren't any more transformations needed.
Someone more educated maybe could correct me on this?

The messy first image is of course incorrect, and that was after trying to transform the t-pose into the inital state and applying the animation.

Anyways, I guess I could look into putting the mesh back out into LoG format.
Shouldn't be a problem for static meshes until I had the time to look over skinned stuff.

Image
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blender 2.71 - Model Importer

Post by Batty »

A Blender exporter to .model would be a huge timesaver, thanks for any and all effort you put into this. :)
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Blender 2.71 - Model Importer

Post by Skuggasveinn »

Just want to chime in also and say thank you for the script, I really appreciate the effort and hope you continue developing it.

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Blender 2.71 - Model Importer

Post by minmay »

This is a big improvement over my previous method (which involved going through 2 intermediate formats), thank you!
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Model Importer

Post by bitcpy »

I had some time this weekend to look over the importer.
My understanding of an armature in Blender wasn't quite correct, so I had to go through some tutorials to check how people set them up.
So I removed the test code and did a new implementation on it, and here's the paste-bin to the new importer.
http://pastebin.com/u0xi57yy

The new importer has some added functionality to it now listed below.

* Full node structure support
It imports the entire node structure and create empty objects accordingly, which you of course can animate if needed.

* Model support
Models are imported as represented in the game.
They are however now transformed properly using the object hierarcy, so if a node scales it by factor 0.001 it doesn't get blown out of proportions anymore.

* Skeleton support
Models with bones automatically has an armature created for it now, as well as skinning groups assigned so you can start editing it directly.
It's also placed in the default pose, but you can still go back to the rest pose if needed.

* Animation support
Animations can be imported onto a armature now, simply select .animation menu item and select the armature to apply it to.
Framerate is automatically changed to match the animation, and keyframes are inserted whenever there is a track for it in the animation file.

Thinking about it now it's kind of stupid to require one since only the nodes potentially could be animated.
I'll see if I can get around and fix that.

Another thing, importing animations can take a couple of seconds, it's kinda stupidly done since it potentially updates the scene several hundred times during building. I'll might look into that too.

Also, the armature might not always be perfect :)

Images are always fun, so here's an example of the Lindworm loaded with the roar animation applied to it.
Image
User avatar
Doridion
Posts: 256
Joined: Tue Jun 10, 2014 9:23 pm

Re: Blender 2.71 - Model Importer

Post by Doridion »

Really, really, really awesome, what a work ! Gratz to you bitcpy !
Post Reply