Author Topic: Request: FFVII camera data importer for Blender  (Read 6215 times)

anaho

  • *
  • Posts: 143
  • King Of Slowdown
    • View Profile
Request: FFVII camera data importer for Blender
« on: 2012-01-11 14:17:01 »
Hello,

my name is anaho and I am working with Team Avalance on the Bombing Mission project ( see the related pictures in the thread)
Someone named Spoox, who is also active, seems to have a working camera importer for 3DSMax.
He once commented on a wlkmesh script in this thread: http://forums.qhimm.com/index.php?topic=11781.0

#----------------------------------------------------------
# BLINELE.py
#----------------------------------------------------------
import bpy
 
def createMesh(name,  verts, edges, faces):
    # Create mesh and object
    me = bpy.data.meshes.new(name+'Mesh')
    ob = bpy.data.objects.new(name, me)
    ob.show_name = True
    # Link object to scene
    bpy.context.scene.objects.link(ob)
 
    # Create mesh from given verts, edges, faces. Either edges or
    # faces should be [], or you ask for problems
    me.from_pydata(verts, edges, faces)
 
    # Update mesh with new data
    me.update(calc_edges=True)
    return ob

def run():
   # Verts
    verts1 = (
    (-128.0,1.0,0.0),
    (-128.0,99.0,0.0),
    (-84.0,97.0,0.0),
    (2.0,28.0,0.0),
    (-33.0,108.0,0.0),
    (-128.0,120.0,0.0),
    (-127.0,137.0,0.0),
    (-95.0,138.0,0.0),
    (51.0,107.0,0.0),
    (140.0,18.0,0.0),
    (140.0,108.0,0.0),
    (0.0,-142.0,0.0),
    (-128.0,-142.0,0.0),
    (142.0,-140.0,0.0),
    (50.0,182.0,0.0),
    (-33.0,181.0,0.0),
    (-31.0,310.0,0.0),
    (-193.0,313.0,0.0),
    (-193.0,181.0,0.0),
    (105.0,313.0,0.0),
    (235.0,182.0,0.0),
    (235.0,312.0,0.0))


    faces1 = (
    (0,1,2),
    (2,3,0),
    (4,3,2),
    (5,6,7),
    (4,8,3),
    (8,9,3),
    (10,9,8),
    (11,0,3),
    (11,12,0),
    (9,11,3),
    (9,13,11),
    (4,14,8),
    (15,14,4),
    (15,16,14),
    (17,16,15),
    (18,17,15),
    (19,14,16),
    (19,20,14),
    (21,20,19))

    ob1 = createMesh('WalkMesh',  verts1, [], faces1)

    return
 
if __name__ == "__main__":
    run()


I dont know programming nor python but having a camera importer would substantialyy speed up modelling and make animations possible ( I am unwilling to match everything frame by frame for sanitys sake).
How are the chances of ever seeing such a importer? Judging from Spoox comments he got it working relatively fast in 3DSMAX.


SpooX

  • ah nothing really...
  • *
  • Posts: 344
  • Used to be errr...
    • View Profile
Re: Request: FFVII camera data importer for Blender
« Reply #1 on: 2012-01-11 22:36:41 »
Hi Anaho,

if time permits I'll have another look at it.

currently the tool I made is not for releasing (it's just a complete mess of code with many unfinished parts  ::) )

the walkmeshes have already been released a long time ago (you could search for those) although they are not exported very well (that's why I made my own exporter in the first place  :-))

If however someone could deliver the DVD posted in Here, I'll stop anything I'm doing right now and get you the exporter next week  :evil:

anaho

  • *
  • Posts: 143
  • King Of Slowdown
    • View Profile
Re: Request: FFVII camera data importer for Blender
« Reply #2 on: 2012-01-12 20:10:45 »
Do you have any sources or references on the FFVII cam data available?

SpooX

  • ah nothing really...
  • *
  • Posts: 344
  • Used to be errr...
    • View Profile
Re: Request: FFVII camera data importer for Blender
« Reply #3 on: 2012-01-16 20:37:21 »
Do you have any sources or references on the FFVII cam data available?
All the references are in the wiki.


as said, I'm not quite at hom in blender so if someone wants to try out this one;
Code: [Select]
# -------------------------------------------------------------------
# MD1_1 walkmesh (and cam) Blender Python script generated by SpooX
# -------------------------------------------------------------------
import bpy
import math
import mathutils

def createMesh(name, verts, edges, faces):
    me = bpy.data.meshes.new(name+'Mesh')
    ob = bpy.data.objects.new(name, me)
    ob.show_name = True
    bpy.context.scene.objects.link(ob)
    me.from_pydata(verts, edges, faces)
    me.update(calc_edges=True)
    return ob

def putCam():
    # Create a camera and get the shape name.
    data = bpy.data.cameras.new('MD1_1Cam')
    vcam = bpy.data.objects.new('MD1_1Cam', data)
    vcam.location = (2742.157,4146.049,-1892.855)
    vcam.rotation_euler = (0.0, 0.0, 0.0)
    dx = 2741.702 - 2742.157
    dy = 4145.376 - 4146.049
    dz = -1892.272 - -1892.855
    xRad = (3.14159/2.) + math.atan2(dz, math.sqrt(dy**2 + dx**2))
    zRad = math.atan2(dy, dx) - (3.14159256 / 2.)
    vcam.rotation_euler = mathutils.Euler((xRad, 0, zRad), 'XYZ')
    vcam.scale = (1.0, 1.0, 1.0)
    data.lens = 143.394
    data.draw_size = 100
    bpy.context.scene.objects.link(vcam)

def run():
    verts1 = (
    (1084.0,1297.0,6140.0),
    (1273.0,1320.0,6105.0),
    (1108.0,1298.0,5964.0),
    (1260.0,1277.0,5912.0),
    (1319.0,1272.0,5918.0),
    (1263.0,1272.0,5850.0),
    (1095.0,1298.0,5847.0),
    (932.0,1298.0,5744.0),
    (2076.0,1319.0,5714.0),
    (2119.0,1309.0,5998.0),
    (1322.0,1272.0,5857.0),
    (1842.0,1296.0,4756.0),
    (1225.0,1276.0,5376.0),
    (883.0,1319.0,5589.0),
    (919.0,1304.0,5351.0),
    (892.0,1296.0,5060.0),
    (724.0,1304.0,5598.0),
    (703.0,1304.0,5362.0),
    (295.0,1304.0,5408.0),
    (325.0,1304.0,5609.0),
    (366.0,1304.0,5834.0),
    (742.0,1304.0,5814.0),
    (659.0,1304.0,5212.0),
    (258.0,1304.0,5206.0),
    (2128.0,1281.0,5096.0),
    (2441.0,1280.0,5135.0),
    (2539.0,1319.0,4682.0),
    (2635.0,1280.0,5088.0),
    (2819.0,1319.0,5340.0),
    (2988.0,1296.0,5340.0),
    (2371.0,1337.0,3419.0),
    (2755.0,1298.0,2960.0),
    (2031.0,1298.0,3023.0),
    (1813.0,1298.0,3571.0),
    (1914.0,1298.0,3571.0),
    (1910.0,1298.0,3460.0),
    (1959.0,1298.0,3462.0),
    (1975.0,1298.0,3571.0),
    (2123.0,1298.0,3460.0),
    (2117.0,1298.0,3571.0),
    (2012.0,1296.0,2768.0),
    (1710.0,1296.0,3383.0),
    (1640.0,1296.0,2805.0),
    (745.0,1319.0,3197.0),
    (945.0,1298.0,3028.0),
    (751.0,1296.0,3320.0),
    (566.0,1319.0,3190.0),
    (603.0,1296.0,3336.0),
    (1185.0,1276.0,3796.0),
    (1612.0,1276.0,3830.0),
    (760.0,1296.0,3442.0),
    (679.0,1295.0,3676.0),
    (644.0,1318.0,3490.0),
    (700.0,1295.0,4028.0),
    (1031.0,1295.0,4338.0),
    (449.0,1295.0,4278.0),
    (381.0,1296.0,4053.0),
    (2192.0,1298.0,3460.0),
    (2195.0,1298.0,3540.0),
    (2313.0,1298.0,3451.0),
    (1802.0,1298.0,3466.0),
    (771.0,1298.0,2104.0),
    (1056.0,1298.0,2006.0),
    (666.0,1307.0,1969.0),
    (686.0,1307.0,2112.0),
    (1322.0,1298.0,1896.0),
    (1543.0,1319.0,1894.0),
    (1291.0,1298.0,1616.0),
    (1001.0,1298.0,1645.0),
    (1070.0,1298.0,1144.0),
    (783.0,1298.0,1164.0),
    (359.0,1319.0,1714.0),
    (344.0,1296.0,1432.0),
    (108.0,1298.0,1189.0),
    (-181.0,1296.0,1488.0),
    (-128.0,1298.0,1214.0),
    (1632.0,1298.0,1125.0),
    (2390.0,1298.0,1499.0),
    (2342.0,1298.0,1041.0),
    (1203.0,1296.0,805.0),
    (1014.0,1296.0,824.0),
    (1121.0,1296.0,475.0),
    (1145.0,1296.0,264.0),
    (1372.0,1272.0,-423.0),
    (1460.0,1298.0,-485.0),
    (1115.0,1296.0,-3.0),
    (1322.0,1298.0,-508.0),
    (785.0,1298.0,-455.0),
    (894.0,1296.0,8.0),
    (2319.0,1298.0,3531.0),
    (967.0,1296.0,492.0),
    (929.0,1296.0,289.0),
    (837.0,1296.0,506.0),
    (808.0,1296.0,301.0),
    (208.0,1304.0,5626.0),
    (174.0,1304.0,5421.0),
    (21.0,1304.0,5655.0),
    (-2.0,1304.0,5440.0),
    (1183.0,1276.0,4792.0))

    faces1 = (
    (0,1,2),
    (1,3,2),
    (4,3,1),
    (3,5,2),
    (5,6,2),
    (7,6,5),
    (8,4,1),
    (9,8,1),
    (4,8,10),
    (11,10,8),
    (11,5,10),
    (12,5,11),
    (12,7,5),
    (13,7,12),
    (14,13,12),
    (15,14,12),
    (14,16,13),
    (17,16,14),
    (16,17,18),
    (18,19,16),
    (19,20,16),
    (20,21,16),
    (18,17,22),
    (18,22,23),
    (8,24,11),
    (11,24,25),
    (11,25,26),
    (26,25,27),
    (28,26,27),
    (28,29,26),
    (29,30,26),
    (31,30,29),
    (31,32,30),
    (33,34,35),
    (36,37,38),
    (37,39,38),
    (40,41,32),
    (40,42,41),
    (43,41,44),
    (43,45,41),
    (46,45,43),
    (46,47,45),
    (45,48,41),
    (48,49,41),
    (50,48,45),
    (50,51,48),
    (52,51,50),
    (51,53,48),
    (53,54,48),
    (55,54,53),
    (56,55,53),
    (57,58,59),
    (60,33,35),
    (41,42,44),
    (44,42,61),
    (61,42,62),
    (63,61,62),
    (63,64,61),
    (65,62,42),
    (66,65,42),
    (65,67,62),
    (67,68,62),
    (69,68,67),
    (69,70,68),
    (70,71,68),
    (72,71,70),
    (73,72,70),
    (73,74,72),
    (75,74,73),
    (76,69,67),
    (67,77,76),
    (77,78,76),
    (76,79,69),
    (79,80,69),
    (81,79,76),
    (82,81,76),
    (57,59,32),
    (59,30,32),
    (83,82,76),
    (83,76,84),
    (83,85,82),
    (86,85,83),
    (85,86,87),
    (85,87,88),
    (36,38,32),
    (38,57,32),
    (58,89,59),
    (41,60,32),
    (60,35,32),
    (35,36,32),
    (82,90,81),
    (91,90,82),
    (91,92,90),
    (93,92,91),
    (18,94,19),
    (95,94,18),
    (95,96,94),
    (97,96,95),
    (98,15,12),
    (11,98,12))

    ob1 = createMesh('MD1_1WalkMesh',  verts1, [], faces1)
    putCam()
    return
if __name__ == "__main__":
    run()

and let me know what the results are....
 8-)

anaho

  • *
  • Posts: 143
  • King Of Slowdown
    • View Profile
Re: Request: FFVII camera data importer for Blender
« Reply #4 on: 2012-01-23 08:56:46 »
Thanks for the effort again, Spoox.
This seems "to run" on Blender 2.61 64 run on WIN7 64.
It successfully creates a mesh and a camera in the Outliner.
However, if you leave everything as is you see nothing.
You can fix that by selecting the walkmesh and under "Object", then "Transform" and select "Geometry to Origin". This places it to the default origin.
## Actually that behavior might be correct, as the walkmesh´s origin might not have been (0,0,0)???##

However, it appears to be very, very big and the rotation is of IMHO.
Also I think it looks weird. (sse attached picture)

The camera is successfully created but is huuuge as well. And you dont see the walkmesh looking through it ( you can do that by hitting Numpad 0). It is located: X:2742.157 Y:4146.049 Z:-1892.855 
Rotation: X:125.665° Y:0° Z:-214.062  Focal Length: 143.394

I have a 3DSMAX Script that transfers whole .max scenes to Blender. This includes the camera as well. Maybe you want it?

anaho

  • *
  • Posts: 143
  • King Of Slowdown
    • View Profile