I was playing around with getting simple models from blender into soya3d.  To get it to work right, I've made two changes to import_blender.py.  The first change is on line 76 of the 0.2.1 distribution.  I changed "if(face.col != None)" to "if(len(face.col) != 0)", which I may have already mentioned in another e-mail.  Without this change it import_blender.py crashes.  The other change was to the logic of whether look for tex_x and tex_y coords on line 84.  I couldn't get materials to map (no tex_x or tex_y) until I did this change.  After making this change I can create a simple shape in blender, then in blender press "f" to select faces, then "R" and select Rot UV, then "U" for UV calculation.  At this point I can import_blender.py creates an output file that launches EditObj with an object that I can add materials to.  The resulting world loads into soya3d with working textures.  :)  Here is the second change I made:

FROM:
         # vertex texture coordinates
         if(face.image):
            uv = face.uv[index]
            code = code + "v.tex_x = " + str(uv[0]) + "\nv.tex_y = " + str(1.0 - uv[1]) + "\n"
            # vertexuvco[0]
            # vertexuvco[1]

TO:
          # vertex texture coordinates
          if(len(face.uv) !=0):
            uv = face.uv[index]
            code = code + "v.tex_x = " + str(uv[0]) + "\nv.tex_y = " + str(1.0 - uv[1]) + "\n"
            # vertexuvco[0]
            # vertexuvco[1]


Complex models that I've downloaded and tried to run import_blender.py against still cause import_blender.py to loop, I haven't tried to figure out why (yet).


Hope this helps. 


--
Jack Madison <[EMAIL PROTECTED]>

Reply via email to