Page 1 of 2

dino and aliens msh files

Posted: Wed Aug 01, 2012 12:32 pm
by Bogus
hello all
I would like to write a script for blender to import msh files, but I do not know what I'm doing wrong
because i get the error and don't know how to solve it
subject i write here because in 3d/2d models section no one write off, but please for the transfer
if anyone needs sample files please on pw

dino and aliens msh files

Posted: Thu Aug 02, 2012 1:12 pm
by Bogus
does anyone me answer?
please

who knows something about 3d models and scripts?

Re: dino and aliens msh files

Posted: Thu Aug 02, 2012 1:37 pm
by howfie
there's only like one person on here who writes blender scripts to rip games... some polish guy that we rarely see around anymore...

so there's limited help around here when it comes to blender scripts.

Re: dino and aliens msh files

Posted: Thu Aug 02, 2012 4:47 pm
by Bogus
injury
maybe someone else will know?
here is link to demo:
http://www.gamershell.com/download_27844.shtml
here is script for quickbms to dat files:

Code: Select all

# Dino and Aliens
# script for QuickBMS http://quickbms.aluigi.org

get FULLSIZE asize
for OFFSET = 0 < FULLSIZE
    get NAME string
    get SIZE long
    savepos OFFSET
    encryption xor NAME
    log NAME OFFSET SIZE
    math OFFSET += SIZE
    goto OFFSET
next
in demo version msh files are the same like in full version

Re: dino and aliens msh files

Posted: Sat Aug 25, 2012 5:18 pm
by Bogus
maybe this someone will be interested

Code: Select all

#!BPY
""" 
Name: 'Dino and Aliens (.msh)...'
Blender: 249
Group: 'Import'
"""
__author= "Boguslaw Radomski"
__version__= "0.01"

__bpydoc__ = """\
Dino and Aliens msh importer by Boguslaw Radomski
This script imports a Dino and Aliens msh files to Blender.
Note, This loads mesh objects only, materials and animations are not supported yet.
I do not know how to read material from a file and add support to Blender.
"""

# ***** GPL LICENSE *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
#
# --------------------------------------------------------------------------

# importing modules
import Blender
import struct

# imports a msh file to the current scene
def load_msh(filename):
	# get scene
	scn = Blender.Scene.GetCurrent()
	if scn == None:
		return "No scene to import to!"

	Blender.Window.WaitCursor(1)

	# open the file
	file = open(filename, 'rb')

	# read id to check if the file is a dino and aliens msh file
	id = file.read(3)
	if id != 'MSH':
		print 'this is not MSH file'
		return

	file.seek(29,0)

	# Create the mesh
	scn.objects.selected = []
	mesh = Blender.Mesh.New("name")
	meshOb = scn.objects.new(mesh)

	# read the number of vertices
	numVerts = struct.unpack('L', file.read(4))[0]

	# read number of triangles
	numTriangles = struct.unpack('L', file.read(4))[0]

	# read vertices
	verts = []
	for i in xrange(numVerts):
		verts.append(struct.unpack('fff', file.read(3*4)))

	# add the vertices to the mesh
	mesh.verts.extend(verts)

	# read triangles
	faces = []
	for i in xrange(numTriangles):
		# read indices (faces)
		faces.append(struct.unpack('iii', file.read(3*4)))

	# add the faces to the mesh
	mesh.faces.extend(faces)

	Blender.Window.WaitCursor(0)

	# refresh the view
	Blender.Redraw()

	# close the file
	file.close()

Blender.Window.FileSelector(load_msh, 'import msh', '*.msh')
i do not know only how to read materials and animation from files, because never before have not done thereof

Re: dino and aliens msh files

Posted: Sat Aug 25, 2012 9:37 pm
by finale00
No animations, still good. I think a lot of people don't really care for animations either.

Re: dino and aliens msh files

Posted: Sun Aug 26, 2012 6:57 am
by Bogus
has anyone some idea, what they mean the next values?
i do not know how to read
animation files are in .anm files
as someone wants a sample file please on pw

Re: dino and aliens msh files

Posted: Sun Aug 26, 2012 12:13 pm
by shakotay2
Bogus wrote:has anyone some idea, what they mean the next values?
i do not know how to read
next values in which file; .msh or .anm?

I had a look at teleport_base.msh; it contains 210 faces (triangles).
Although the UV is looking like a horse-shoe you should find
the first texture set at
# 0xfa9
vt 0.979252 0.499962
vt 0.901447 0.585763
...
vt 0.910417 0.499962
vt 0.705208 0.857351
vt 0.674772 0.804343

The next 210 x 8 bytes don't look like an UV map when displaying them in the UV editor.
# 0x1639
#vt 0.608015 0.834229
#vt 0.674772 0.804343
...

edit: hmm, teleport_screen.jpg does not really fit.
edit2: taking only the uneven (or even) vt-lines the UV map looks better (left of pic).
But it should look like the one on right side.
Image

Maybe someones sees what-they-have-done-to the tex coords?
animation files are in .anm files
For a basic understanding of animation data
a look at viewtopic.php?f=29&p=76831#p76831 might be helpful.

As for concret data like vilka_shock.anm I did not find a pattern.
It starts with 0x26 00 00 00 (=38, which should be the frame count).
The data following at 0x000C should all be floats:

Code: Select all

 0.000000 -0.000000 3.806096
 0.000000 -0.000000 3.710460
 0.000000 -0.000000 3.627165
 0.000000 -0.000000 3.700048
 0.000000 -0.000000 3.823235

 -0.000055 0.104600 -0.000281
 -0.000030 0.105238 -0.000120
 0.000020 0.106515 0.000201
 0.000059 0.107473 0.000442
 0.000046 0.107154 0.000362

 -0.104600 -0.000026 1.571075
 -0.105238 -0.000018 1.570916
 -0.106515 -0.000001 1.570596
 -0.107473 0.000011 1.570357
 -0.107154 0.000007 1.570437

 3.141592 -1.570253 1.570804
 3.141583 -1.570249 1.570804
 3.141592 -1.570240 1.570786
 -3.141589 -1.570233 1.570804
 3.141581 -1.570235 1.570804
...
Too much zeroes in there. (But considering something like 28 91 5A 30 as DWORD does not help.)
00 00 00 3E is 0.125 as a float - so everything "below" 00 00 00 38 will be displayed as 0.0.

Frame time values like 0.04, 0.08 for example can't be found.

Don't know; you'll have to figure it out for yourself.

Re: dino and aliens msh files

Posted: Sun Aug 26, 2012 5:44 pm
by Karpati
shakotay2 wrote:Maybe someones sees what-they-have-done-to the tex coords ?
The answer is very simple.
The .msh file uses the UV/Face datas, so every faces have 3*2 floats as UV.

Re: dino and aliens msh files

Posted: Sun Aug 26, 2012 6:12 pm
by Bogus
thanks Karpati
at least i know
where did you get this version 3d object converter?
because there is no to download
besides .msh files are yet .cgo files
i do not know are it appeal to textures?
edit:
i mean the file box.msh, what is on position 0x115 after faces
because with this file i had easily
i know, that cube, box has 8 vertices

Re: dino and aliens msh files

Posted: Sun Aug 26, 2012 10:19 pm
by finale00
He is the developer of the program lol

Re: dino and aliens msh files

Posted: Mon Aug 27, 2012 6:41 am
by Bogus
ok
i didn't know even
but what i can I do that use it in blender?
3d object converter is payable, for free one can only watch models and convert to some formats
edit:
i mean this
http://desmond.imageshack.us/Himg827/sc ... es=landing

Re: dino and aliens msh files

Posted: Mon Aug 27, 2012 10:57 am
by shakotay2
Karpati already gave the answer, didn't he?
Thx to Karpati. :)

There are 36 (12*3) tex coords lines with 2 floats each.

So the box faces look like this:

f 3/1 1/2 4/3
f 2/4 4/5 1/6
f 6/7 5/8 8/9
f 7/10 8/11 5/12
f 2/13 1/14 6/15
f 5/16 6/17 1/18
f 4/19 2/20 8/21
f 6/22 8/23 2/24
f 3/25 4/26 7/27
f 8/28 7/29 4/30
f 1/31 3/32 5/33
f 7/34 5/35 3/36

Means the tex coords indices are counted up from 1 to 36.

Re: dino and aliens msh files

Posted: Mon Aug 27, 2012 11:24 am
by Bogus
ok thanks
now I was left with just add it to script although will be me a little hard
surely need will to add yet loop
edit:
shakotay2 can you give me a script in which the grid is displayed in the UV editor?
please
I'm trying go further with the script, but i have problem, appears the error:
index out of range
and i do not know what further to do

Re: dino and aliens msh files

Posted: Wed Aug 29, 2012 8:32 am
by Bogus
help me someone?
please
how should peek out script for uv mapping?
because i do not know how