Menu

#2 Texturing not working

open
nobody
None
5
2004-06-26
2004-06-26
No

I've installed blend2java and it works perfectly,
however, I can't get it to recognize a material that
has texturing added. It's not finding the texture (ie:
the "print 'texture found'") statement isn't being
called. Do I have to do something special within
blender for blend2java to discover a texture?

Discussion

  • Anonymous

    Anonymous - 2004-06-26

    Logged In: YES
    user_id=699257

    Ok, I found on the editing button window (F9) that you have
    to enable the Texface button (press Make). However, now I
    get "Python error, see console for details when I run the
    Blend2Java script. This is on the console:

    <Blender NMesh object at 0x4257ab30>
    Traceback (most recent call last):
    File "<string>", line 426, in bevent
    File "<string>", line 443, in StartExport
    File "<string>", line 300, in meshToShape3DXMLList
    File "<string>", line 266, in meshComponentToShape3DXML
    AttributeError: 'NoneType' object has no attribute 'getName'

    Perhaps there is a bug in the script, perhaps I need to
    enable something else yet to get texturing to work. I'll
    continue trying to debug it.

     
  • Anonymous

    Anonymous - 2004-06-26

    Logged In: YES
    user_id=699257

    I didn't get it working as it was, so I edited the script.
    Here's the diff. I don't know if this is a problem with the
    script or just a messy hack because I don't know what I'm
    doing with Blender. I'm using this version, at any rate, I
    thought you might be interested in the alterations.
    ----DIFF BELOW----
    --- export.py 2004-06-26 15:56:47.000000000 -0600
    +++ java3d.py 2004-06-26 15:53:05.000000000 -0600
    @@ -1,3 +1,10 @@
    +#!BPY

    +

    +"""

    +Name: 'Blend2Java'

    +Blender: 232

    +Group: 'Export'

    +"""

    import Blender

    from Blender import NMesh

    from Blender import Image

    @@ -256,10 +263,11 @@
    xml.fromstring(tabs + "<object
    class=\"javax.media.j3d.Shape3D\">\n")

    if (mesh.hasFaceUV()) :

    - tex = str(faces[0].image.getName())

    + #tex = str(faces[0].image.getName())

    + tex =
    materials[0].getTextures()[0].tex.getImage().getFilename()

    # this is for removing .00x from reloaded texture
    names....

    if (tex.find(".0") != -1) :

    - #print "debug "+tex

    + print "debug "+tex

    #print "debug "+str(tex.rfind(".0"))

    tex = tex[0:tex.rfind(".0")]

    # --------------------------------------------------------

    ----DIFF ABOVE----

     

Log in to post a comment.