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!
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Blender 2.71 - Importer / Exporter

Post by AdrTru »

I am not able to use this animation import.
Can somebody create some videotutorial with applicating animation to model, please?
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 - Importer / Exporter

Post by germanny »

@Ddrtru:

- rename the downloaded script - make it short and no spaces, use underscore, name can be anything.
- copy that im/export script into a blender script resource folder= \scripts\addons or better- \scripts\addons_contrib
- start blender, go File->User Preferences->Addons, search after named addon and check it to active.
Done so far^^
Import:
- go File->Import->Legend of Grimrock 2...model, file requester opens.
- Select 'Grimrock2.dat' within your LoG2 installation.
- File requester, left side - scroll all the way down to find the list of all entrys inside 'Grimrock2.dat'
- select the model you want to load
Done.
Animation import:
- go File->Import->Legend of Grimrock 2...animation, file requester opens.
- Select 'Grimrock2.dat' within your LoG2 installation.
- File requester, left side - scroll all the way down to find the list of all anims inside 'Grimrock2.dat'
- above that listing, there is a field named 'Armature', here you must select the armature from your model BEFORE loading!
- select the animation you want to load
Done!
Where to find the new animation sequence?
- Open the Animation-Editor window (top menu of blender, list selector).
- There you will find a list-button named 'Dope-Sheet' , change to 'Action Editor'.
- Inside action editor you´ll find a text/listfield, if you hover over with mouse it says: ..collection of F-curves..
- There you find the new animation data into an action.
- To load another, klick the 'plus' symbol right of it and select the new one, rename it as you wish.
Command: A+DEL delete all data inside!
- Go again to import - animation, the new set saves into the selected new action set.
And so on.

Hope this helps for first steps.
Dungeon Master Resource Pack worker and passionated Beer drinker
User avatar
Lark
Posts: 178
Joined: Wed Sep 19, 2012 4:23 pm
Location: Springfield, MO USA

Re: Blender 2.71 - Importer / Exporter

Post by Lark »

I'm having some real problems trying to import dungeon_wall_alcove back into the game, unaltered (as a test). If I use importer version 1.2 or 1.3, the model looks okay in Blender, but it won't export directly to .model format (tons of errors and a 0-byte file results) and, when I export it as normal to .obj format, it's really screwy in GMT. The faces are transparent on the front sides, GMT's rotation and viewing controls are backwards or otherwise really weird - it's very hard to rotate the model around. And when I put it into the game, it's rotated 90 degrees off, sits in the middle of a square (instead of along the wall as it should), and the faces aren't textured... much like in GMT. If I turn off backface clipping on GMT, it looks okay, but of course, still isn't useable in LoG2.

If I import the same model using an earlier version of the importer (1.0?), the model looks find in GMT, rotates properly, and it looks just fine and it's in the proper orientation in LoG2, but I can't texture it - perhaps because I can't recalculate the tangents: GMT says, "Need position, normal and texture data in existing mesh to calculate tangents". Blender has the texture defined and displayed, and it looks great.

A simple update has turned into hours of trial and error without anything that works in the end. I'm stumped again. Any help would be greatly appreciated. I know I'm a real newb, but I'm trying! Thanks, -Lark
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blender 2.71 - Importer / Exporter

Post by Batty »

Lark, there can be many steps involved. I'll try to help with some. I've had hit or miss success with exporting as .model. Some are just fine and only need recalculate normals & tangents in GMT, others create the errors you're getting (and I've done the same things to both models, setup same structure, etc., could be me though :oops: ).

Some help...first, select the entire mesh in edit mode and do Mesh -> Vertices -> Remove Doubles. Blender will flash a message at top center of the screen saying how many verts have been removed. You have to do that for every .model you import. If you export .obj from Blender and the faces disappear, easy fix, the normals have been flipped. Go into edit mode, select all the problem faces then do Mesh -> Normals -> Flip Normals.

I just tested importing the dungeon_wall_alcove and exporting as .model into GMT and it's fine. I have no problems exporting .model as long as no changes are made. Is it possible you have leftover objects in the scene? Open Blender, hit delete and get rid of the cube, maximize the window, then press Ctrl-U and select Save Startup File? Now you always have a clean scene when you start, try the alcove again.

I haven't tried to texture an imported .model yet so I'm not sure what's happening there.

It can be tricky to align the Blender and Grimrock worlds. To get your models positioned correctly, you have to have the game_matrix & RootNode in Blender setup correctly, you also have to assign textures to their respective meshes. Remember that Blender has the vertical axis as z whereas it's y in Grimrock. If everything is setup correctly, you can export as .obj with only needing to recalc normals & tangents in GMT.
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Blender 2.71 - Importer / Exporter

Post by AdrTru »

@germany:
Thank you very much, your description is very useful.
(my problem wos in filling Armature field in import dialog :) )
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter

Post by bitcpy »

I put all versions and started putting down some basic help and documentation on an add-on page for the script.
Also made some minor updates to it,

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

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

Changes
  • Quads are now split the same way Mikkelsen does it so that triangels matches Blenders bake and tangent frame.
  • Model tangent space is correctly rotated with the game matrix so that baked normals in Blender works out of the box in game (not well tested though).
  • The splitting of quads have been standardised to work the same way Blender handles quad splits during for example bake of tangent space normal maps.
  • The armature option is no longer needed and the importer will apply changes to bones automatically if they exists in an armature in the scene.
    When the bone can't be found the node will be animated instead and simply ignored in case neither node or bone could be found.
  • Animation import now handles importing of animations not supported for scene object. Missing nodes will simply be ignored.
  • If setting up scenes from scratch, the game matrix can be created from the Tools panels Create tab where Add Primitive is, look for Legend of Grimrock panel.
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter

Post by bitcpy »

@Lark
I tried with the latest 1.3.1 which worked fine. Bringing it into Blender, then exporting and opening it in GMT.
You shouldn't need to bring it into GMT for tangent re-calculations with the latest, it should work just fine in the game.
(I'll double check that in a couple of minutes)

If there's still problem, let me know and I'll see what we can do about it.

@everyone
Thanks for helping each other out :)
User avatar
Aisuu
Posts: 61
Joined: Fri Oct 31, 2014 2:07 pm

Re: Blender 2.71 - Importer / Exporter

Post by Aisuu »

What a great tool, thx bitcpy :)

I was playing around. I imported monster model, modified it and export it successfully.
Monster work just fine, with only one error in game.
my_monster does not have source data. Am I doing something wrong? Should I ignore it?
SpoilerShow

Code: Select all

defineObject{
	name = "my_monster",
	baseObject = "ratling2",
	components = {
		{
			class = "Model",
			model = "mod_assets/models/monsters/test.fbx",
		}
	}
}
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blender 2.71 - Importer / Exporter

Post by Batty »

Thanks bitcpy! This is becoming a terrific resource. I especially like the one-click game matrix setup and no tangent recalcs. :D

Here's the error I get with some meshes I export as .model but It's my doing, I think, because there are some open ended faces in the mesh...(see RuntimeError at bottom)
SpoilerShow
Image
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter

Post by bitcpy »

I'm glad you girls/guys like it and are finding it useful! :)

@Batty
Yes, there are n-gons in the mesh which aren't supported export time.
Until it is, I was thinking about adding support for selecting the invidalid faces so you can see them whenever the export fails on it.
One thing you can do in the meantime is triangulate it manually if you're having problem finding the n-gon.
I don't think you can bake normal maps in blender from these kind of meshes either (if blender automatically doesn't triangulate it for you first)

@Aisuu
Oh, I'm not sure I understand. source data?
I never done asset definitions for monsters if that is where your hickup occours.
But just a quick glance at other peoples attempt to bring in LoG1 monsters they seem to be using something called 'storeSourceData' in their model Component (no idea what it actually does).

example,

Code: Select all

components = {
      {
         class = "Model",
         model = "mod_assets/models/monsters/test.fbx",
         storeSourceData = true,
      }
Post Reply