Author Topic: [Xenogears] Level viewer in Python  (Read 26453 times)

Mako

  • *
  • Posts: 669
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #25 on: 2010-06-19 15:03:32 »
Quote
Yes, of course, but I wouldn't make it a Blender plugin.

Yes this :)!. God I loves me some Xenogears tools thanks Micky.
« Last Edit: 2010-06-19 15:25:23 by Mako »

Micky

  • *
  • Posts: 300
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #26 on: 2010-06-30 05:35:22 »


I updated the viewer in the first message and the file extractor in the fifth message.

The viewer now exports the scene into a collada .dae file if you press 'c' while the scene is visible. It's quick and dirty but gives you the geometry and textures. The Blender collada plugin doesn't seem to handle vertex colours, or my export of vertex colours is wrong, as they come out as all white. And transparency is not exported, yet. The file doesn't work with Sketchup, though you can re-export it from Blender and import that into Sketchup. But then you seem to lose the textures? The file name is level<room>.dae .
You may want to adjust the far clipping plane in Blender to something big to avoid the scene to be cut off. You can enable textured view, but shaded view is all black because there is no light.
I'll need to dive into the source for the collada plugin at some point to see if I can improve that, but for now I'm too busy.

The file extractor now calculates the size of movie files correctly.
« Last Edit: 2010-06-30 05:39:44 by Micky »

O01eg

  • *
  • Posts: 23
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #27 on: 2010-07-03 09:53:11 »
Nice.
Which version of pyopengl you use? When I press "N" I got:
Quote
Traceback (most recent call last):
  File "model.py", line 1057, in <module>
    main(*sys.argv[1:])
  File "model.py", line 984, in main
    object.draw_normals = not object.draw_normals
AttributeError: OpenGLObject instance has no attribute 'draw_normals'

Micky

  • *
  • Posts: 300
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #28 on: 2010-07-03 11:50:15 »
Nice.
Which version of pyopengl you use? When I press "N" I got:
Quote
Traceback (most recent call last):
  File "model.py", line 1057, in <module>
    main(*sys.argv[1:])
  File "model.py", line 984, in main
    object.draw_normals = not object.draw_normals
AttributeError: OpenGLObject instance has no attribute 'draw_normals'
Sorry, that's a leftover from the FF7 field model/animation viewer, and probably worth removing that line. Maybe I'll implement it if I adapt it for battle models.

Riz

  • Guest
Re: [Xenogears] Level viewer in Python
« Reply #29 on: 2010-08-03 23:40:12 »
Awesome work as usual.
Seems transparency is not working fully :(

Btw, exported textures were all red before I've changed line 558 to
image = pygame.image.fromstring(t, (256, 256), "ARGB", True)
but I am on Linux, so this can be the case.

Micky

  • *
  • Posts: 300
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #30 on: 2010-08-04 21:10:00 »
Seems transparency is not working fully :(
The textures contain transparency if you look at them in Gimp. Though I haven't found a way for Blender to pick that up, yet.
Quote
Btw, exported textures were all red before I've changed line 558 to
image = pygame.image.fromstring(t, (256, 256), "ARGB", True)
but I am on Linux, so this can be the case.
Probably because I'm on a big endian platform and you're using a little endian pc. Alpha is 255 for most of the pixel, which is red if you reverse the byte order. I'll see if I can fix that if I make another version.

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #31 on: 2010-08-04 22:06:36 »
Seems transparency is not working fully :(
The textures contain transparency if you look at them in Gimp. Though I haven't found a way for Blender to pick that up, yet.
Quote
Btw, exported textures were all red before I've changed line 558 to
image = pygame.image.fromstring(t, (256, 256), "ARGB", True)
but I am on Linux, so this can be the case.
Probably because I'm on a big endian platform and you're using a little endian pc. Alpha is 255 for most of the pixel, which is red if you reverse the byte order. I'll see if I can fix that if I make another version.
Does python have an endianess check?
A quick glance suggests it does  in ctypes. I know this is a problem sometimes dealing with ARM based architectures as well.

Cyb

Micky

  • *
  • Posts: 300
    • View Profile
Re: [Xenogears] Level viewer in Python
« Reply #32 on: 2010-08-04 22:46:30 »
Does python have an endianess check?
A quick glance suggests it does  in ctypes. I know this is a problem sometimes dealing with ARM based architectures as well.
There is a check in the sys module as well. I tried to write the OpenGL texture loader in a way that it works correctly both ways, so I'll have to check if there is a good way to do the same for the .tga writer.
I noticed the VRAM contains NPC sprites and I've got some ideas I want to try. Does anyone know where the party sprites (outside a battle) are?
And has anyone looked into the object instance flags, yet? I'm sure some of them are for placing NPCs, but some must be controlling animations (for example for smoke) and billboards (camera-facing quads).
« Last Edit: 2010-08-04 22:57:15 by Micky »