ANIM_3D_TRANS Blender Export possible - python

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
User avatar
astorian
Trained
Trained
Posts: 159
Joined: 29 Jun 2009, 12:26

ANIM_3D_TRANS Blender Export possible - python

Post by astorian »

Hello to all WZ fans, contributors and especially development team.
I was helping some people creating/exporting animations from Blender to a game project. The game used models with animations in game engine - calling separate animation file that contained the rotation/movement parameters for set of objects.
So i remembered the time i spend to work on WZ2100 and i realized the same thing of animation could be used for WZ.
I am talking about work that can be actually done in the current state of the WZ2100 project without code change.

The ANIM_3D_TRANS type of animating models in WZ makes it possible. HOW?
The ani file contains the rotation/movement/scaling coordinates for each objects center that is contained in the animation pie file. A good example is the oil-rig file:

/* header format: anim3d [filename] [frames][framerate] [num objects] */
/* anim line: [frame] [x] [y] [z] [xrot] [yrot] [zrot][xscale] [yscale] [zscale] */
ANIM3DTRANS "BLDerik.pie" 25 15 3
{
ANIMOBJECT 0 "DerrickBase"
{
0 0 0 0 0 0 0 1000 1000 1000
1 0 0 0 0 0 0 1000 1000 1000
2 0 0 0 0 0 0 1000 1000 1000
3 0 0 0 0 0 0 1000 1000 1000
4 0 0 0 0 0 0 1000 1000 1000
5 0 0 0 0 0 0 1000 1000 1000
6 0 0 0 0 0 0 1000 1000 1000
7 0 0 0 0 0 0 1000 1000 1000
8 0 0 0 0 0 0 1000 1000 1000
9 0 0 0 0 0 0 1000 1000 1000
10 0 0 0 0 0 0 1000 1000 1000
11 0 0 0 0 0 0 1000 1000 1000
12 0 0 0 0 0 0 1000 1000 1000
13 0 0 0 0 0 0 1000 1000 1000
14 0 0 0 0 0 0 1000 1000 1000
15 0 0 0 0 0 0 1000 1000 1000
16 0 0 0 0 0 0 1000 1000 1000
17 0 0 0 0 0 0 1000 1000 1000
18 0 0 0 0 0 0 1000 1000 1000
19 0 0 0 0 0 0 1000 1000 1000
20 0 0 0 0 0 0 1000 1000 1000
21 0 0 0 0 0 0 1000 1000 1000
22 0 0 0 0 0 0 1000 1000 1000
23 0 0 0 0 0 0 1000 1000 1000
24 0 0 0 0 0 0 1000 1000 1000
}

ANIMOBJECT 1 "Piston"
{
0 0 0 0 0 0 0 999 1000 1000
1 0 0 544 0 0 0 999 1000 1000
2 0 0 2056 0 0 0 999 1000 1000
3 0 0 4349 0 0 0 999 1000 1000
4 0 0 7242 0 0 0 999 1000 1000
5 0 0 10548 0 0 0 999 1000 1000
6 0 0 14085 0 0 0 999 1000 1000
7 0 0 17668 0 0 0 999 1000 1000
8 0 0 21112 0 0 0 999 1000 1000
9 0 0 24235 0 0 0 999 1000 1000
10 0 0 26851 0 0 0 999 1000 1000
11 0 0 28776 0 0 0 999 1000 1000
12 0 0 29827 0 0 0 999 1000 1000
13 0 0 29827 0 0 0 999 1000 1000
14 0 0 28776 0 0 0 999 1000 1000
15 0 0 26851 0 0 0 999 1000 1000
16 0 0 24235 0 0 0 999 1000 1000
17 0 0 21112 0 0 0 999 1000 1000
18 0 0 17668 0 0 0 999 1000 1000
19 0 0 14085 0 0 0 999 1000 1000
20 0 0 10548 0 0 0 999 1000 1000
21 0 0 7242 0 0 0 999 1000 1000
22 0 0 4349 0 0 0 999 1000 1000
23 0 0 2056 0 0 0 999 1000 1000
24 0 0 544 0 0 0 999 1000 1000
}

ANIMOBJECT 2 "Box03"
{
0 0 0 0 0 0 0 1000 1000 1000
1 -671 0 168 0 480 0 999 1000 999
2 -2680 0 707 0 1921 0 999 1000 999
3 -6001 0 1720 0 4328 0 999 1000 999
4 -10581 0 3374 0 7705 0 999 1000 999
5 -16322 0 5895 0 12052 0 999 1000 999
6 -23053 0 9556 0 17365 0 1000 1000 1000
7 -29891 0 14178 0 23089 0 999 1000 999
8 -35243 0 18562 0 27886 0 1000 1000 1000
9 -39228 0 22361 0 31703 0 1000 1000 1000
10 -42031 0 25362 0 34550 0 1000 1000 1000
11 -43808 0 27430 0 36440 0 1000 1000 1000
12 -44668 0 28482 0 37382 0 999 1000 999
13 -44668 0 28482 0 37382 0 999 1000 999
14 -43808 0 27430 0 36440 0 1000 1000 1000
15 -42031 0 25362 0 34550 0 1000 1000 1000
16 -39228 0 22361 0 31703 0 1000 1000 1000
17 -35243 0 18562 0 27886 0 1000 1000 1000
18 -29891 0 14178 0 23089 0 999 1000 999
19 -23053 0 9556 0 17365 0 1000 1000 1000
20 -16322 0 5895 0 12052 0 999 1000 999
21 -10581 0 3374 0 7705 0 999 1000 999
22 -6001 0 1720 0 4328 0 999 1000 999
23 -2680 0 707 0 1921 0 999 1000 999
24 -671 0 168 0 480 0 999 1000 999
}
}
The power of this animation type is that the game only loads the models (3 in this case: DerrickBase, Piston and Box03) and uses the coordinates to move,rotate and scale them. So you are able to do smooth animations using small amount of resources with just adding more "action" lines to the ani file.
(The frame animation has to load all models in each frame, so a smooth animation would consume lots of resources to preload all frames. And you would have to create lots of frames to make the animation smooth.)

I know what you think: Manually adding lines to the ANIM_3D_TRANS ani file takes huge amount of time. Therefore the whole idea is based on the automation of the animation process using blender's exporter. So you create a pie file for the static object and then animate them in blender (walk cycle for example) and then export an .ani file like the one above used for oil derrick.
Therefore i am looking for Python coders to help me create a python export script for blender, that creates a ani file - export coordinates and rotation to a text file. Its nothing new, those export scripts exists already, but i lack script skill to do that.
If there is a WZ fan or artist that understand python scripting and willing to help, plz let us know!

Best Regards,
Astorian
User avatar
MaNGusT
Art contributor
Posts: 1154
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: ANIM_3D_TRANS Blender Export possible - python

Post by MaNGusT »

The problem is that only the oil derrick can be animated using ANIM_3D_TRANS. :-S
viewtopic.php?f=5&t=3947&start=15#p39350
Image
User avatar
astorian
Trained
Trained
Posts: 159
Joined: 29 Jun 2009, 12:26

Re: ANIM_3D_TRANS Blender Export possible - python

Post by astorian »

MaNGusT wrote:The problem is that only the oil derrick can be animated using ANIM_3D_TRANS. :-S
viewtopic.php?f=5&t=3947&start=15#p39350
Well that is not true, i successfully tested ANIM_3D_TRANS animations on cyborgs pie files and on custom objects.
Its just the ani file that decides what type of animation is used.
I used a custom model of a wheel for instead of cyborg and animated the rotation. It was simple since there was only one z axis coordinate and i used y axis rotation to spin the wheel. Worked without problems.

Best Regards,
Astorian
User avatar
Buginator
Professional
Professional
Posts: 3285
Joined: 04 Nov 2007, 02:20

Re: ANIM_3D_TRANS Blender Export possible - python

Post by Buginator »

Can you post the script?
and it ends here.
User avatar
astorian
Trained
Trained
Posts: 159
Joined: 29 Jun 2009, 12:26

Re: ANIM_3D_TRANS Blender Export possible - python

Post by astorian »

Buginator wrote:Can you post the script?
You mean a python script for blender exporting cordinates? Or the custom ini for the cyborg i made?
Astorian
User avatar
Square
Trained
Trained
Posts: 76
Joined: 06 Jan 2009, 15:45

Re: ANIM_3D_TRANS Blender Export possible - python

Post by Square »

maybe both, but I would be interested in the pie ans ani files^^
User avatar
astorian
Trained
Trained
Posts: 159
Joined: 29 Jun 2009, 12:26

Re: ANIM_3D_TRANS Blender Export possible - python

Post by astorian »

Square wrote:maybe both, but I would be interested in the pie ans ani files^^
Hi i will make new ones in few days and post them here so you can try them out.
Astorian