An-Cadsolutions      Imgsystems

Kirjoittaja Aihe: Blender mesh importer  (Luettu 323 kertaa)

xcx

  • Administrator
  • *****
  • Viestejä: 2278
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
Blender mesh importer
« : Maaliskuu 01, 2010, 11:17:07 am »
W.I.P, mutta näytti toimivan. Hyvin yksinkertainen mesh importer. Tuo vain geometrian ja pitää pivotin oikeassa paikassa ja orientaatiossa. Tarkoitus tälle on tuoda dummy obuja simulaatioita varten. Eli tämä ei ole sopiva varsinaisten rendattavien meshien tuomiseen. Animaatio importer seuraa perässä, kun löytyy sopiva väli tehdä se.

Nysvään tästä vielä käyttäjä ystävällisemmän jossain vaiheessa, mutta jos joku haluaa kehitellä tai kokeilla niin tässä tämän hetkistä koodia.

3DSMax exporter ( maxscript )
Koodia: [Valitse]
struct meshExportStruct
(
fn exportMesh m strName =
(
t = m.transform
m.transform = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])
strMeshData = StringStream ""
iVertCount = m.numVerts
iFaceCount = m.numFaces
aVerts = #()
aFaces = #()

for i=1 to iVertCount do
append aVerts (getVert m i)

for i=1 to iFaceCount do
append aFaces (getFace m i)


format "%\n" strName to:strMeshData
format "%\n" iVertCount to:strMeshData
format "%\n" iFaceCount to:strMeshData
format "%\n" (t.position) to:strMeshData
r = (t.rotation as eulerangles)
format "[%,%,%]\n" (degtorad r.x) (degtorad r.y) (degtorad r.z) to:strMeshData
for i=1 to iVertCount do format "%\n" (aVerts[i]) to:strMeshData
for i=1 to iFaceCount do format "%\n" (aFaces[i]) to:strMeshData

(strMeshData as string)
),

fn export file =
(
strData = StringStream ""
iMeshCount = 0

--try
(
for o in selection do
(
m = snapshot o
iMeshCount += 1
format "%" (exportMesh m (o.name)) to:strData
)

format "%\n" iMeshCount to:file
format "%" (strData as string) to:file
)
--catch
--(
-- messageBox "Can not export meshes. Some object may not be geometry."
-- return undefined
--)
)
)

holdMaxFile()
s = meshExportStruct()
strFile = getSaveFileName "Save mesh file" types:"*.msa|*.msa"
if (strFile != undefined) then
(
format "Exporting mesh...\n"
file = createFile strFile
if (s.export file) != undefined then
messageBox "Mesh exported."
else
messageBox "Mesh export failed. Check your MaxScript listener for details."
close file
format "Mesh exported.\n"
)
else
format "Mesh export cancelled.\n"
fetchMaxFile quiet:true

Blender importer ( python )
Koodia: [Valitse]
import Blender
import bpy

file = open ("C:/temp/test.msa")

strMeshCount = file.readline();
iMeshCount = int ( strMeshCount );
print "Mesh count: " + str (iMeshCount) + "\n";
print "Reading mesh\n";

for i in range (0, iMeshCount):
strMeshName = file.readline();
print "\tMesh name: " + strMeshName;

strVertCount = file.readline();
iVertCount = int ( strVertCount );
print "\tVertex count: " + str ( iVertCount );

strFaceCount = file.readline();
iFaceCount = int ( strFaceCount );
print "\tFace count: " + str ( iFaceCount );

strPosition = file.readline();
positionArray = [];
a = strPosition.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
positionArray.append(float(strX));
positionArray.append(float(strY));
positionArray.append(float(strZ));

strRotation = file.readline();
rotationArray = [];
a = strRotation.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
rotationArray.append(float(strX));
rotationArray.append(float(strY));
rotationArray.append(float(strZ));

print "\tReading vertices data\n";
verticesArray = [];
for j in range (0, iVertCount):
strVert = file.readline();
a = strVert.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
vertArray = [];
vertArray.append(float(strX));
vertArray.append(float(strY));
vertArray.append(float(strZ));
verticesArray.append( vertArray );
#print (vertArray);

print "\tReading face data\n"
facesArray = [];
for j in range (0, iFaceCount):
strFace = file.readline();
a = strFace.split("[");
a = a[1].split("]");
strABC = a[0].split(",");
strA = strABC[0];
strB = strABC[1];
strC = strABC[2];
faceArray = [];
faceArray.append(int(strA)-1);
faceArray.append(int(strB)-1);
faceArray.append(int(strC)-1);
facesArray.append( faceArray );
#print (faceArray);

print "\tCreating mesh\n"
me = bpy.data.meshes.new(strMeshName);
me.verts.extend( verticesArray );
me.faces.extend( facesArray );

scn = bpy.data.scenes.active;
obj = scn.objects.new(me, strMeshName);

obj.RotX = rotationArray[0];
obj.RotY = rotationArray[1];
obj.RotZ = rotationArray[2];

obj.LocX = positionArray[0];
obj.LocY = positionArray[1];
obj.LocZ = positionArray[2];


print "Mesh readed.\n";

Blender.Redraw()
« Viimeksi muokattu: Maaliskuu 01, 2010, 01:12:17 pm kirjoittanut xcx »
Technical Artist - Remedy Games
http://www.verajankorva.com

xcx

  • Administrator
  • *****
  • Viestejä: 2278
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
Vs: Blender mesh importer
« Vastaus #1 : Maaliskuu 01, 2010, 11:26:34 am »
Specsit tiedostoformaatille. Pyrin pitämään formaatin helppona lukea, joka varmaan puree perseelle kohtapuoleen, mutta toistaiseksi näin.

Rivi 1: Meshin lukumäärä
Rivi 2: Ensimmäisen meshin nimi
Rivi 3: Verteksien lukumäärä
Rivi 4: Facejen lukumäärä
Rivi 5: Meshin position ( world coords. )
Rivi 6: Meshin rotaation ( world coords. )
*: Verteksien data ( [ x, y, z ] local coords. )
*: Face data ( [ x, y, z ] euler rad )
*: Seuraava mesh ( kts. rivi 2 )
*: Seuraava mesh ( kts. rivi 2 )
*: Seuraava mesh ( kts. rivi 2 )
Technical Artist - Remedy Games
http://www.verajankorva.com

xcx

  • Administrator
  • *****
  • Viestejä: 2278
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
Vs: Blender mesh importer
« Vastaus #2 : Maaliskuu 01, 2010, 07:35:49 pm »
Work in progress...

3dsmax animation export
Koodia: [Valitse]
/*
Text animation format export.
*/

objs = #()
transforms = #()

if ( queryBox "Export selected objects as TXT format?" ) do
(
strFile = getSaveFileName "Save TXT" types:"*.txt|*.txt"
if ( strFile != "" ) do
(
format "Writing animation to file % ... please wait...\n" strFile
file = createFile strFile
for o in selection do
append objs o

for f=animationRange.start to animationRange.end do
(
at time f
(
in coordsys #world
(
for o in objs do
(
try
(
strLine = (o.name)
strLine += " " + (f.frame as string)
p = o.position
r = o.rotation
strLine += " " + (p.x as string) + "," + (p.y as string) + "," + (p.z as string)
strLine += " " + (r.x as string) + "," + (r.y as string) + "," + (r.z as string) + "," + (r.w as string)
--strLine += " " + ((degToRad r.x) as string) + "," + ((degToRad r.y) as string) + "," + ((degToRad r.z) as string)
--strLine += " " + ((r.x) as string) + "," + ((r.y) as string) + "," + ((r.z) as string)
format "%\n" strLine to:file
)
catch
(
format "Error when writing a file.\n"
close file
)
)
)
)
)
format "Done\n"
close file
)
)

3dsmax animation import
Koodia: [Valitse]
file = openFile ( "c:/temp/testAnimation.txt" )

in coordsys #world
(
while (not eof file) do
(
with animate on
(
strLine = readLine file
a = filterString strLine " "
strName = a[1]
strFrame = a[2]
strPos = a[3]
strRot = a[4]

at time ( strFrame as integer )
(
sp = filterString strPos ","
sr = filterString strRot ","
p = Point3 (sp[1] as float) (sp[2] as float) (sp[3] as float)
r = Quat ((sr[1] as float)) ((sr[2] as float)) ((sr[3] as float)) ((sr[4] as float))
n = getNodeByName strName exact:true
n.rotation = r
n.position = p
)
)
)
)
close file


Blender animation import ( ötököitä vielä :(, mutta postaan silti jos joku vaikka äkkää miksi rotaatiot menee persiilleen. )
Koodia: [Valitse]
import Blender
from Blender import Mathutils

def importAnimation(filename):
     iFrame = 0
     fProgress = 0.0
     iNumLines = sum(1 for line in open(filename))
     fProgressStep = 100.0 / iNumLines
     file = open (filename)
     for strLine in file:
         a = strLine.split(" ")
         strName = a[0]
         strFrame = a[1]
         strPos = a[2]
         strRot = a[3]

         obj = Blender.Object.Get(strName)

         Blender.Set("curframe",int(float(strFrame)))
         iFrame += 1

         RotX = float( strRot.split(",")[0] )
         RotY = float( strRot.split(",")[1] )
         RotZ = float( strRot.split(",")[2] )
         RotW = float( strRot.split(",")[3] )
         r = [RotX, RotY, RotZ]

         PosX = float( strPos.split(",")[0] )
         PosY = float( strPos.split(",")[1] )
         PosZ = float( strPos.split(",")[2] )
         p = [PosX, PosY, PosZ]

         q = Mathutils.Quaternion( r, RotW )
         obj.setEuler( q.toEuler() )
         obj.loc = p
         obj.insertIpoKey(Blender.Object.LOCROT)

         fProgress += fProgressStep
         Blender.Window.DrawProgressBar(fProgress,"Importing animation")

Blender.Window.FileSelector(importAnimation, "Import")
print "Done"
Blender.Redraw()

Blender mesh import tunattu versio.
Koodia: [Valitse]
import Blender
import bpy

def importMesh(filename):
file = open (filename)

strMeshCount = file.readline();
iMeshCount = int ( strMeshCount );
print "Mesh count: " + str (iMeshCount) + "\n";
print "Reading mesh\n";

for i in range (0, iMeshCount):
strMeshName = file.readline();
strMeshName = strMeshName.strip();
print "\tMesh name: " + strMeshName;

strVertCount = file.readline();
iVertCount = int ( strVertCount );
print "\tVertex count: " + str ( iVertCount );

strFaceCount = file.readline();
iFaceCount = int ( strFaceCount );
print "\tFace count: " + str ( iFaceCount );

strPosition = file.readline();
positionArray = [];
a = strPosition.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
positionArray.append(float(strX));
positionArray.append(float(strY));
positionArray.append(float(strZ));

strRotation = file.readline();
rotationArray = [];
a = strRotation.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
rotationArray.append(float(strX));
rotationArray.append(float(strY));
rotationArray.append(float(strZ));

print "\tReading vertices data\n";
verticesArray = [];
for j in range (0, iVertCount):
strVert = file.readline();
a = strVert.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
vertArray = [];
vertArray.append(float(strX));
vertArray.append(float(strY));
vertArray.append(float(strZ));
verticesArray.append( vertArray );
#print (vertArray);

print "\tReading face data\n"
facesArray = [];
for j in range (0, iFaceCount):
strFace = file.readline();
a = strFace.split("[");
a = a[1].split("]");
strABC = a[0].split(",");
strA = strABC[0];
strB = strABC[1];
strC = strABC[2];
faceArray = [];
faceArray.append(int(strA)-1);
faceArray.append(int(strB)-1);
faceArray.append(int(strC)-1);
facesArray.append( faceArray );
#print (faceArray);

print "\tCreating mesh\n"
me = bpy.data.meshes.new(strMeshName);
me.verts.extend( verticesArray );
me.faces.extend( facesArray );

scn = bpy.data.scenes.active;
obj = scn.objects.new(me, strMeshName);

obj.RotX = rotationArray[0];
obj.RotY = rotationArray[1];
obj.RotZ = rotationArray[2];

obj.LocX = positionArray[0];
obj.LocY = positionArray[1];
obj.LocZ = positionArray[2];


print "Mesh readed.\n";

Blender.Window.FileSelector(importMesh, "Import")
Blender.Redraw()
« Viimeksi muokattu: Maaliskuu 02, 2010, 09:58:02 am kirjoittanut xcx »
Technical Artist - Remedy Games
http://www.verajankorva.com

Tak

  • Administrator
  • *****
  • Viestejä: 959
  • Sukupuoli: Mies
    • Profiili
Vs: Blender mesh importer
« Vastaus #3 : Maaliskuu 01, 2010, 10:16:38 pm »
Jospa huomenna ehtis koittaa. Hienoa että osaat + viittiit tehä näitä :)

xcx

  • Administrator
  • *****
  • Viestejä: 2278
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
Vs: Blender mesh importer
« Vastaus #4 : Maaliskuu 02, 2010, 06:11:57 pm »
Work in progress...

Vääntöjen vääntö, mutta alkaa olla valoa tunnelin päässä.

Updatea. Sanotaan, että alpha 1.

Max toolit

Mesh export
Koodia: [Valitse]
struct meshExportStruct
(
fn exportMesh m strName =
(
t = m.transform
m.transform = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])
strMeshData = StringStream ""
iVertCount = m.numVerts
iFaceCount = m.numFaces
aVerts = #()
aFaces = #()

for i=1 to iVertCount do
append aVerts (getVert m i)

for i=1 to iFaceCount do
append aFaces (getFace m i)


format "%\n" strName to:strMeshData
format "%\n" iVertCount to:strMeshData
format "%\n" iFaceCount to:strMeshData
format "%\n" (t.position) to:strMeshData
r = (t.rotation as eulerangles)
format "[%,%,%]\n" (degtorad r.x) (degtorad r.y) (degtorad r.z) to:strMeshData
for i=1 to iVertCount do format "%\n" (aVerts[i]) to:strMeshData
for i=1 to iFaceCount do format "%\n" (aFaces[i]) to:strMeshData

(strMeshData as string)
),

fn export file =
(
strData = StringStream ""
iMeshCount = 0

--try
(
for o in selection do
(
m = snapshot o
iMeshCount += 1
format "%" (exportMesh m (o.name)) to:strData
)

format "%\n" iMeshCount to:file
format "%" (strData as string) to:file
)
--catch
--(
-- messageBox "Can not export meshes. Some object may not be geometry."
-- return undefined
--)
)
)

holdMaxFile()
s = meshExportStruct()
strFile = getSaveFileName "Save mesh file" types:"*.msa|*.msa"
if (strFile != undefined) then
(
format "Exporting mesh...\n"
file = createFile strFile
if (s.export file) != undefined then
messageBox "Mesh exported."
else
messageBox "Mesh export failed. Check your MaxScript listener for details."
close file
format "Mesh exported.\n"
)
else
format "Mesh export cancelled.\n"
fetchMaxFile quiet:true

Animation export
Koodia: [Valitse]
/*
Text animation format export.

Version 1.1

Version list:

1.0
- Basic KF animation export.
- Rotation choices
- euler angles
- angle axis
- quaternions
- Simple UI.

1.1
- Can save transformations as matrices.
*/

rollout DialogRollout "Rollout"
(
group ""
(
label l1 "Ascii animation export"
label l2 "1.1"
label l3 ""
label l4 "Bake animations to every frame and export animation as"
label l5 "custom file format (*.aca)."
)
group "Rotations"
(
radiobuttons rotformat_rbn labels:#("Euler", "Angle axis", "Quaternion")
)
checkbox matrix_chk "Export transforms as matrices." checked:true
label l61
button export_btn " Export animation "

label l7 "Progress" align:#left
progressBar prgbar

on export_btn pressed do
(
objs = #()
transforms = #()

strFile = getSaveFileName "Save TXT" types:"*.txt|*.txt"
if ( strFile != "" ) do
(
format "Writing animation to file % ... please wait...\n" strFile
file = createFile strFile
for o in selection do
append objs o

fProgress = 0.0
fProgressStep = 100.0 / ((abs(animationRange.start - animationRange.end)) as float)
for f=animationRange.start to animationRange.end do
(
at time f
(
in coordsys #world
(
for o in objs do
(
try
(
strLine = (o.name)
strLine += " " + (f.frame as string)

if ( matrix_chk.checked ) then
(
t = o.transform
strLine += " " + (t.row1.x as string) + "," + (t.row1.y as string) + "," + (t.row1.z as string)
strLine += " " + (t.row2.x as string) + "," + (t.row2.y as string) + "," + (t.row2.z as string)
strLine += " " + (t.row3.x as string) + "," + (t.row3.y as string) + "," + (t.row3.z as string)
strLine += " " + (t.row4.x as string) + "," + (t.row4.y as string) + "," + (t.row4.z as string)
)
else
(
p = o.position
strLine += " " + (p.x as string) + "," + (p.y as string) + "," + (p.z as string)
r =  o.rotation

case (rotformat_rbn.state) of
(
1: -- Euler
(
r = r as EulerAngles
strLine += " " + ((degToRad r.x) as string) + "," + ((degToRad r.y) as string) + "," + ((degToRad r.z) as string)
)
2: -- Angle axis
(
r = r as AngleAxis
strLine += " " + (r.axis.x as string) + "," + (r.axis.y as string) + "," + (r.axis.z as string) + "," + ((degtorad r.angle) as string)
)
3: -- Quaternion
(
strLine += " " + (r.x as string) + "," + (r.y as string) + "," + (r.z as string) + "," + (r.w as string)
)
)
)

format "%\n" strLine to:file
)
catch
(
format "Error when writing a file.\n"
close file
)
)
)
)
fProgress += fProgressStep
prgbar.value = (fProgress as integer)
)
format "Done\n"
close file
destroyDialog DialogRollout
)
)
)

if ( selection.count > 0 ) do
createDialog DialogRollout 300 280 modal:true

Import animation
Koodia: [Valitse]
file = openFile ( "c:/temp/testAnimation.txt" )

in coordsys #world
(
while (not eof file) do
(
with animate on
(
strLine = readLine file
a = filterString strLine " "
strName = a[1]
strFrame = a[2]
strPos = a[3]
strRot = a[4]

at time ( strFrame as integer )
(
sp = filterString strPos ","
sr = filterString strRot ","
p = Point3 (sp[1] as float) (sp[2] as float) (sp[3] as float)
r = Quat ((sr[1] as float)) ((sr[2] as float)) ((sr[3] as float)) ((sr[4] as float))
n = getNodeByName strName exact:true
n.rotation = r
n.position = p
)
)
)
)
close file

Blender toolit

Mesh import
Koodia: [Valitse]
import Blender
import bpy

def importMesh(filename):
file = open (filename)

strMeshCount = file.readline();
iMeshCount = int ( strMeshCount );
print "Mesh count: " + str (iMeshCount) + "\n";
print "Reading mesh\n";

for i in range (0, iMeshCount):
strMeshName = file.readline();
strMeshName = strMeshName.strip();
print "\tMesh name: " + strMeshName;

strVertCount = file.readline();
iVertCount = int ( strVertCount );
print "\tVertex count: " + str ( iVertCount );

strFaceCount = file.readline();
iFaceCount = int ( strFaceCount );
print "\tFace count: " + str ( iFaceCount );

strPosition = file.readline();
positionArray = [];
a = strPosition.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
positionArray.append(float(strX));
positionArray.append(float(strY));
positionArray.append(float(strZ));

strRotation = file.readline();
rotationArray = [];
a = strRotation.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
rotationArray.append(float(strX));
rotationArray.append(float(strY));
rotationArray.append(float(strZ));

print "\tReading vertices data\n";
verticesArray = [];
for j in range (0, iVertCount):
strVert = file.readline();
a = strVert.split("[");
a = a[1].split("]");
strXYZ = a[0].split(",");
strX = strXYZ[0];
strY = strXYZ[1];
strZ = strXYZ[2];
vertArray = [];
vertArray.append(float(strX));
vertArray.append(float(strY));
vertArray.append(float(strZ));
verticesArray.append( vertArray );
#print (vertArray);

print "\tReading face data\n"
facesArray = [];
for j in range (0, iFaceCount):
strFace = file.readline();
a = strFace.split("[");
a = a[1].split("]");
strABC = a[0].split(",");
strA = strABC[0];
strB = strABC[1];
strC = strABC[2];
faceArray = [];
faceArray.append(int(strA)-1);
faceArray.append(int(strB)-1);
faceArray.append(int(strC)-1);
facesArray.append( faceArray );
#print (faceArray);

print "\tCreating mesh\n"
me = bpy.data.meshes.new(strMeshName);
me.verts.extend( verticesArray );
me.faces.extend( facesArray );

scn = bpy.data.scenes.active;
obj = scn.objects.new(me, strMeshName);

obj.RotX = rotationArray[0];
obj.RotY = rotationArray[1];
obj.RotZ = rotationArray[2];

obj.LocX = positionArray[0];
obj.LocY = positionArray[1];
obj.LocZ = positionArray[2];


print "Mesh readed.\n";

Blender.Window.FileSelector(importMesh, "Import")
Blender.Redraw()

Animation import
Koodia: [Valitse]
import Blender
from Blender import Mathutils

def importAnimation(filename):
    iFrame = 0
    fProgress = 0.0
    iNumLines = sum(1 for line in open(filename))
    fProgressStep = 100.0 / iNumLines
    file = open (filename)
    for strLine in file:
a = strLine.split(" ")
strName = a[0]
strFrame = a[1]
strRow1 = a[2]
strRow2 = a[3]
strRow3 = a[4]
strRow4 = a[5]

obj = Blender.Object.Get(strName)

Blender.Set("curframe",int(float(strFrame)))
iFrame += 1

row1X = float( strRow1.split(",")[0] )
row1Y = float( strRow1.split(",")[1] )
row1Z = float( strRow1.split(",")[2] )
row1 = [row1X, row1Y, row1Z, 0]

row2X = float( strRow2.split(",")[0] )
row2Y = float( strRow2.split(",")[1] )
row2Z = float( strRow2.split(",")[2] )
row2 = [row2X, row2Y, row2Z, 0]

row3X = float( strRow3.split(",")[0] )
row3Y = float( strRow3.split(",")[1] )
row3Z = float( strRow3.split(",")[2] )
row3 = [row3X, row3Y, row3Z, 0]

row4X = float( strRow4.split(",")[0] )
row4Y = float( strRow4.split(",")[1] )
row4Z = float( strRow4.split(",")[2] )
row4 = [row4X, row4Y, row4Z, 1]

m = Mathutils.Matrix(row1, row2, row3, row4)
obj.setMatrix(m)
obj.insertIpoKey(Blender.Object.LOCROT)

fProgress += fProgressStep
Blender.Window.DrawProgressBar(fProgress,"Importing animation")

Blender.Window.FileSelector(importAnimation, "Import")
print "Done"
Blender.Redraw()
« Viimeksi muokattu: Maaliskuu 02, 2010, 06:19:51 pm kirjoittanut xcx »
Technical Artist - Remedy Games
http://www.verajankorva.com

ajuss

  • Full Member
  • ***
  • Viestejä: 153
  • Sukupuoli: Mies
    • Profiili
Vs: Blender mesh importer
« Vastaus #5 : Maaliskuu 03, 2010, 08:48:32 am »
hei,
toimiiko ne blenderin skriptit Blender 2.5 Alpha 1:llä?

xcx

  • Administrator
  • *****
  • Viestejä: 2278
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
Vs: Blender mesh importer
« Vastaus #6 : Maaliskuu 03, 2010, 09:50:02 am »
Ei. Nää on vanhalle 2.49 versiolle. 2.5:lle ei varmaan isoja muutoksia tarvii tehdä, mutta en halunnut alkaa kirjoittaa alpha versiolle scriptaa. Niistä kun ei aina voi sanoa, että missä mättää jos jokin ei toimi.
Technical Artist - Remedy Games
http://www.verajankorva.com

xcx

  • Administrator
  • *****
  • Viestejä: 2278
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
Vs: Blender mesh importer
« Vastaus #7 : Maaliskuu 03, 2010, 09:56:24 am »
Jaa niin ja unohdin antaa specit tohon animaatiofilun formaatille.

Rivi kerrallaan luetaan, jokainen rivi on yhden obun transformaatio per frame.

Ensin obun nimi, frame, transformaatiomatriisin row1, row2, row3 ja row4 (position). Blender haluaa nämä 4x4 matriisina joten kirjoita matriisi muodossa.

row1.x, row1.y, row1.z, 0
row2.x, row2.y, row2.z, 0
row3.x, row3.y, row3.z, 0
row4.x, row4.y, row4.z, 1

Animaatio on normia FK animaatiota ja ei tue hierarkiaa. Blender kuitenkin settaa matriisit aina relatiivisesti suhteessa parenttiin, joten älkää yrittäkö pistää obuja hierarkiaan.
Technical Artist - Remedy Games
http://www.verajankorva.com