SUPPORT ACCOUNT CLANS
Welcome, Unregistered.
 

Thread: Blender Model import/export scripts

Page 16 of 20 FirstFirst ... 6121314151617181920 LastLast
Results 301 to 320 of 398
  1. #301
    Hello theli !

    I love that you made an export/import for Blender
    Blender is a great program that sometimes underrated due to being free and FOSS.
    I used to play with it a few years ago, and I bought the 2.5 Blender video course.

    Many people already moved from 2.49 to 2.5 Alpha2 it's time to update your script.
    When the Blender 2.5/2.6 exporter/importer will be ready ?

  2. #302
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    Quote Originally Posted by MaximB View Post
    When the Blender 2.5/2.6 exporter/importer will be ready ?
    http://forums.heroesofnewerth.com/sh...&postcount=161

  3. #303
    I really can't understand how to import the files...

    I want to import Zephyr into Blender.

    I got the right Python version and i got the k2 / hon import. Then i choose "high.model" as Mesh and i've tried a lot of diffrent things in the animation - not choosing anything, choosing the mesh it self, choosing stuff in animation1 etc etc.


    What should i choose to import? :< I've read the whole thread but to no avail.


    What i wanna do is that i want an animation of a Yellow Ward in high res with it's eye looking around like it does ingame, with a transparent background, any help to do this would be extremly appriciated.

    Would love to learn it my self but if someone wanna do it for me i'd be happy as well!
    _██_
    (ಠ_ృ)__________________________________<
    You're mine!

  4. #304
    This is what im looking to create, but with an animated and correct model of course

    http://gyazo.com/29a5959b3ab45c56adbcc75c63113888.png

    Annoying that each tutorial starts with me having successfully imported the model, but i can't seem to get it to work...
    _██_
    (ಠ_ృ)__________________________________<
    You're mine!

  5. #305
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    here is an eye blend file http://dl.dropbox.com/u/4443078/temp/eye.blend
    here is an example render (1.7Mb)




  6. #306
    Quote Originally Posted by theli View Post
    here is an eye blend file http://dl.dropbox.com/u/4443078/temp/eye.blend
    here is an example render (1.7Mb)




    Thank you so much :-) now let's see if i can add the glow... any pointers on how to do that? :-)
    _██_
    (ಠ_ృ)__________________________________<
    You're mine!

  7. #307
    Can you explain how the weighting works please.
    I am trying to create a max script and i have everything working fine except for weighting.
    I tried to read the python code but i am not used to it.
    Just a simple structure like meshid boneid numweights weights or something like that is all i need.

  8. #308
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    Quote Originally Posted by chrrox View Post
    Can you explain how the weighting works please.
    I am trying to create a max script and i have everything working fine except for weighting.
    I tried to read the python code but i am not used to it.
    Just a simple structure like meshid boneid numweights weights or something like that is all i need.
    hey, python is the best thing ever :P

    Code:
    u32 mesh index
    u32 vertices count
      for each vertex:
          u32 weights count
                weightcount floats - weights
                weightcount u32 - indexes (index of bone)

  9. #309
    Thanks that worked perfect.
    can you explain the bone parent id's like that i think i am close with them.
    here is my max script.

    Code:
    if (heapSize < 20000000) then
        heapSize = 200000000 -- allow ~ 40 MB instead of just 7.5 MB. Prevents "Runtime Error: Out of scripter memory"
    
    fname = getOpenFileName \ 
    caption:"Open Heroes of Newerth Model File" \
    types:"Heroes of Newerth Model File(*.model)|*.model" \
    historyCategory:"Heroes of NewerthObjectPresets"
    f = fopen fname "rb"
    
    fn ReadFixedString bstream fixedLen =
    (
        local str = ""
        for i = 1 to fixedLen do
        (
            str += bit.intAsChar (ReadByte bstream #unsigned)
        )
        str
    )
    
    SMDLhead = ReadFixedString f 8
    unk01 = readlong f
    version = readlong f
    num_meshes = readlong f
    num_sprites = readlong f
    num_surfs = readlong f
    BoneCount = readlong f
    fseek f 0x18#seek_cur
    bone1 = ReadFixedString f 4
    bonesize = readlong f
    
    BNArr = #()
    for i = 1 to BoneCount Do (
    BoneParentID = readlong f
    BoneParentID = (BoneParentID + 1)
    m11 = readfloat f; m12 = readfloat f; m13 = readfloat f
    m21 = readfloat f; m22 = readfloat f; m23 = readfloat f
    m31 = readfloat f; m32 = readfloat f; m33 = readfloat f
    m41 = readfloat f; m42 = readfloat f; m43 = readfloat f
    tfm = matrix3 [m11,m12,m13] [m21,m22,m23] [m31,m32,m33] [m41,m42,m43]
    tfm = inverse tfm
    m11 = readfloat f; m12 = readfloat f; m13 = readfloat f
    m21 = readfloat f; m22 = readfloat f; m23 = readfloat f
    m31 = readfloat f; m32 = readfloat f; m33 = readfloat f
    m41 = readfloat f; m42 = readfloat f; m43 = readfloat f
    tfm2 = matrix3 [m11,m12,m13] [m21,m22,m23] [m31,m32,m33] [m41,m42,m43]
    bnamesize = readbyte f#unsigned
    BoneName = readstring f    
    
        newBone = bonesys.createbone    \
                      tfm.row4    \
                      (tfm.row4 + 0.01 * (normalize tfm.row1)) \
                      (normalize tfm.row3)
                newBone.name   = BoneName
                newBone.width  = 0.3
                newBone.height = 0.3
                newBone.wirecolor = yellow
                newbone.showlinks = true
                newBone.setBoneEnable false 0
                newBone.pos.controller      = TCB_position ()
                newBone.rotation.controller = TCB_rotation ()
    
    append BNArr newBone
     if i != 1 then
     newBone.parent = BNArr[BoneParentID]
    )
    
    
    
    --fseek f bonesize#seek_cur -- skip bones
    mesh1 = ReadFixedString f 4
    unk07 = readlong f
    unk08 = readlong f
    unk09 = readlong f
    VertexCount = readlong f
    fseek f 0x1C#seek_cur
    nsize1 = readbyte f#unsigned
    nsize2 = readbyte f#unsigned
    nname1 = readstring f
    nname2 = readstring f
    
    Vert_array = #()
    Normal_array = #()
    UV_array = #()
    Face_array = #()
    
    vrts = ReadFixedString f 4
    vrts_size = readlong f
    null = readlong f
    for a = 1 to VertexCount Do (
    vx = readfloat f     --read xyz coordinates
    vy = readfloat f 
    vz = readfloat f
    append Vert_array [vx,vy,vz] --save verts to Vert_array    
    )
    lnk1 = ReadFixedString f 4
    lnk1_size = readlong f
    null1 = readlong f
    weightc1 = readlong f
    struct weight_data
    (
        boneids,weights
    )
    Weight_array = #()
    used_id_array = #()
    for a = 1 to weightc1 Do (
    w = (weight_data boneids:#() weights:#())
    maxweight = 0
    WeightCount = readlong f
    
    if WeightCount == 1 do (
    weight1 = readfloat f
    weight2 = 0
    weight3 = 0
    weight4 = 0
    weight5 = 0
    weight6 = 0
    weight7 = 0
    bone1 = readlong f
    )
    if WeightCount == 2 do (
    weight1 = readfloat f
    weight2 = readfloat f
    weight3 = 0
    weight4 = 0
    weight5 = 0
    weight6 = 0
    weight7 = 0
    bone1 = readlong f
    bone2 = readlong f
    )
    if WeightCount == 3 do (
    weight1 = readfloat f
    weight2 = readfloat f
    weight3 = readfloat f
    weight4 = 0
    weight5 = 0
    weight6 = 0
    weight7 = 0
    bone1 = readlong f
    bone2 = readlong f
    bone3 = readlong f
    )
    if WeightCount == 4 do (
    weight1 = readfloat f
    weight2 = readfloat f
    weight3 = readfloat f
    weight4 = readfloat f
    weight5 = 0
    weight6 = 0
    weight7 = 0
    bone1 = readlong f
    bone2 = readlong f
    bone3 = readlong f
    bone4 = readlong f
    )
    if WeightCount == 5 do (
    weight1 = readfloat f
    weight2 = readfloat f
    weight3 = readfloat f
    weight4 = readfloat f
    weight5 = readfloat f
    weight6 = 0
    weight7 = 0
    bone1 = readlong f
    bone2 = readlong f
    bone3 = readlong f
    bone4 = readlong f
    bone5 = readlong f
    )
    if WeightCount == 6 do (
    weight1 = readfloat f
    weight2 = readfloat f
    weight3 = readfloat f
    weight4 = readfloat f
    weight5 = readfloat f
    weight6 = readfloat f
    weight7 = 0
    bone1 = readlong f
    bone2 = readlong f
    bone3 = readlong f
    bone4 = readlong f
    bone5 = readlong f
    bone6 = readlong f
    )
    if WeightCount == 7 do (
    weight1 = readfloat f
    weight2 = readfloat f
    weight3 = readfloat f
    weight4 = readfloat f
    weight5 = readfloat f
    weight6 = readfloat f
    weight7 = readfloat f
    bone1 = readlong f
    bone2 = readlong f
    bone3 = readlong f
    bone4 = readlong f
    bone5 = readlong f
    bone6 = readlong f
    bone7 = readlong f
    )
    if(weight1 != 0) then
        maxweight = maxweight + weight1
    if(weight2 != 0) then
        maxweight = maxweight + weight2
    if(weight3 != 0) then
        maxweight = maxweight + weight3
    if(weight4 != 0) then
        maxweight = maxweight + weight4
    if(weight5 != 0) then
        maxweight = maxweight + weight5
    if(weight6 != 0) then
        maxweight = maxweight + weight6
    if(weight7 != 0) then
        maxweight = maxweight + weight7
    if(maxweight != 0) then
        (
            if(weight1 != 0) then
            (
                w1 = weight1 as float
                append w.boneids (bone1+1) --BoneID_array[bone1+1])
                append w.weights (w1 / 100.0)
                append used_id_array (bone1+1)
            )
            if(weight2 != 0) then
            (
                w2 = weight2 as float
                append w.boneids (bone2+1) --(BoneID_array[bone2+1])
                append w.weights (w2 / 100.0)
                append used_id_array (bone2+1)
            )
            if(weight3 != 0) then
            (
                w3 = weight3 as float
                append w.boneids (bone3+1)--(BoneID_array[bone3+1])
                append w.weights (w3 / 100.0)
                append used_id_array (bone3+1)
            )
            if(weight4 != 0) then
            (
                w4 = weight4 as float
                append w.boneids (bone4+1)--(BoneID_array[bone4+1])
                append w.weights (w4 / 100.0)
                append used_id_array (bone4+1)
            )    
            if(weight5 != 0) then
            (
                w5 = weight5 as float
                append w.boneids (bone5+1)--(BoneID_array[bone4+1])
                append w.weights (w5 / 100.0)
                append used_id_array (bone5+1)
            )        
            if(weight6 != 0) then
            (
                w6 = weight6 as float
                append w.boneids (bone6+1)--(BoneID_array[bone6+1])
                append w.weights (w6 / 100.0)
                append used_id_array (bone6+1)
            )            
                    if(weight7 != 0) then
            (
                w7 = weight7 as float
                append w.boneids (bone7+1)--(BoneID_array[bone6+1])
                append w.weights (w7 / 100.0)
                append used_id_array (bone7+1)
            )        
        )
        append Weight_array w
        
        
    )
    
    
    --fseek f lnk1_size#seek_cur
    face = ReadFixedString f 4
    face_size = readlong f
    null = readlong f
    face_count = readlong f
    facesize2 = readbyte f#unsigned
    for a = 1 to face_count Do (
    f1 = (readshort f) + 1   --read face indices, games are start form 0, but Max start from 1
    f2 = (readshort f) + 1   --so we add 1 to each index
    f3 = (readshort f) + 1
    append Face_array [f1,f2,f3] --save faces to Face_array    
    )
    texc = ReadFixedString f 4
    texc_size = readlong f
    null = readlong f
    null = readlong f
    for a = 1 to VertexCount Do (
    tu = readfloat f     --read UV float value
    tv = (readfloat f) * -1 
    append UV_array [tu,tv,0]  --save UVs to UV_array        
    )
    
    tang = ReadFixedString f 4
    tang_size = readlong f
    fseek f tang_size#seek_cur
    
    sign = ReadFixedString f 4
    sign_size = readlong f
    if sign == "nrml" do (
    null = readlong f
    for a = 1 to VertexCount Do (
    nx = readfloat f     --read xyz coordinates
    ny = readfloat f 
    nz = readfloat f
    append Normal_array [nx,ny,nz] --save verts to Vert_array    
    )
    )
    if sign == "sign" do (
    fseek f sign_size#seek_cur
    )
    total_size = getFileSize fname
    if total_size != (ftell f) do (
    nrml = ReadFixedString f 4
    nrml_size = readlong f
    null = readlong f
    for a = 1 to VertexCount Do (
    nx = readfloat f     --read xyz coordinates
    ny = readfloat f 
    nz = readfloat f
    append Normal_array [nx,ny,nz] --save verts to Vert_array    
    )    
    )
    msh = mesh vertices:Vert_array faces:Face_array   --build mesh
    msh.numTVerts = UV_array.count
    buildTVFaces msh
    for j = 1 to UV_array.count do setTVert msh j UV_array[j]
    for j = 1 to Face_array.count do setTVFace msh j Face_array[j]
    for j = 1 to Normal_array.count do setNormal msh j Normal_array[j]
        
    max modify mode
    select msh
    skinMod = skin ()
    addModifier msh skinMod
    for i = 1 to BNArr.count do
    (
        maxbone = getnodebyname BNArr[i].name
        if i != BNArr.count then
            skinOps.addBone skinMod maxbone 0
        else
            skinOps.addBone skinMod maxbone 1
        
    )
    
    modPanel.setCurrentObject skinMod
    
    for i = 1 to Weight_array.count do
    (
        w = Weight_array[i]
        bi = #() --bone index array
        wv = #() --weight value array
        
        for j = 1 to w.boneids.count do
        (
            boneid = w.boneids[j]
            weight = w.weights[j]
            append bi boneid
            append wv weight
        )    
        
        skinOps.ReplaceVertexWeights skinMod i bi wv
        
    )
    for i = 1 to BNArr.count do (
        j = i + 1
        if i == j do (
        if used_id_array[i] != used_id_array[j] do (
        
    skinOps.removebone skinMod used_id_array[i]
        )
    )
    )
    
    max create mode
    
    
    fclose f

  10. #310
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    Quote Originally Posted by chrrox View Post
    Thanks that worked perfect.
    can you explain the bone parent id's like that i think i am close with them.
    here is my max script.
    huh?

  11. #311
    Are the bones split into sections?
    When i import the bones i get this.This does not look like normal bone parenting to me.
    I am taking the id and adding 1 to it and this is what i get.
    Here is what i get with chronos.


  12. #312
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    why are you adding 1 ?
    this is the correct bone parenting tree

    Bip01 Spine is folded but you get the idea

  13. #313
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    [2010.06.14]
    updated scripts, import script now supports animation clips from Savage 1 (silverback engine)

  14. #314
    Hey theli, great job on your script so far! I've been using it for months now and it is just awesome, I love it.
    I'm not sure if you know this already or have any plans on fixing it, but when I export a clip using your script, it is approximately 3 times larger than a clip exported using the S2 exporter.
    When I tried opening and comparing two animation clips (Max and Blender exports), I noticed that your clips have more repeating data.
    Anyway, this isn't anything big but I think it would make your script one step closer to perfection if fixed.

  15. #315
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    Quote Originally Posted by XIII View Post
    Hey theli, great job on your script so far! I've been using it for months now and it is just awesome, I love it.
    I'm not sure if you know this already or have any plans on fixing it, but when I export a clip using your script, it is approximately 3 times larger than a clip exported using the S2 exporter.
    When I tried opening and comparing two animation clips (Max and Blender exports), I noticed that your clips have more repeating data.
    Anyway, this isn't anything big but I think it would make your script one step closer to perfection if fixed.
    hm, i'm pretty sure i had implemented motion key compression in exporter .. however it was absent ...
    anyway .. i reimplemented that and also added new setting to export script - how much digits to leave for motion keys after decimal point when rounding (bigger - more precise, smaller - smaller filesize) ... setting it to 4 (default) you will end with file a bit bigger then original, with 3 you will get file a bit smaller then original

  16. #316
    Thanks for the update! I just tried it with the default settings and it worked real nice.

  17. #317
    Any news about porting this to blender 2.5? I would be very thankful for it, since 2.5 is the only version I'm familiar with. (because of the new user interface) The beta is already out.

  18. #318
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Kyiv, Ukraine
    Posts
    1,895
    Quote Originally Posted by K4spi View Post
    Any news about porting this to blender 2.5? I would be very thankful for it, since 2.5 is the only version I'm familiar with. (because of the new user interface) The beta is already out.
    i know that beta is out, and i still plan to port.. however i don't have much time atm for that ... but i'll port it someday ... patches are welcome :P

  19. #319
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Oct 2009
    Location
    Finland (sucks)
    Posts
    165
    Simply awesome!

  20. #320
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Aug 2009
    Location
    Somewhere.
    Posts
    717
    Just thought I would stop by and say thanks.
    Also would love to have it on the newer versions since they make life so much easier
    Its just a hassle to use 2.49b to export/import things but I'll manage somehow.
    Just dont let this awesome thing die.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •