Help with the track exporter scrip!

Help with the track exporter scrip!

Postby eliminator » 15 Apr 2010, 00:28

When I export the STK track script (In blender) is said:
{l Code}: {l Select All Code}
   File "<string>", line 1, in <module>
  File "/home/jacob/.blender/scripts/Stk_track.py", line 25, in <module>
    import b3d_export
ImportError: No module named b3d_export


Then I downloaded the b3d script and now is says:
{l Code}: {l Select All Code}
    exporter = TrackExport(sFilename)
  File "/home/jacob/.blender/scripts/Stk_track.py", line 1194, in __init__
    b3d_export.write_b3d_file(sFilename+"_track.b3d", lTrack)
AttributeError: 'module' object has no attribute 'write_b3d_file'
Check out my YouTube, my FaceBook, and my Mods!
User avatar
eliminator
 
Posts: 36
Joined: 25 Mar 2010, 17:02

Re: Help with the track exporter scrip!

Postby hiker » 15 Apr 2010, 04:41

Hi,
...
eliminator {l Wrote}:Then I downloaded the b3d script and now is says:
{l Code}: {l Select All Code}
    exporter = TrackExport(sFilename)
  File "/home/jacob/.blender/scripts/Stk_track.py", line 1194, in __init__
    b3d_export.write_b3d_file(sFilename+"_track.b3d", lTrack)
AttributeError: 'module' object has no attribute 'write_b3d_file'

Where did you download the b3d exporter from? You should use our version, which has some improvements over the 'original' (which afaik is not online anymore). If you are using your self compiled version of STK, you have to use the latest version in SVN to work properly:
http://supertuxkart.svn.sourceforge.net ... y?view=log

Let us know if you have more problems.We hope to do a alpha 2 release in a few days, so that all scripts and links would be consistent again, and then it would be easier to install the scripts in blender.


Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Help with the track exporter scrip!

Postby eliminator » 15 Apr 2010, 05:20

Thanks! :) Ill try it.
Check out my YouTube, my FaceBook, and my Mods!
User avatar
eliminator
 
Posts: 36
Joined: 25 Mar 2010, 17:02

Re: Help with the track exporter scrip!

Postby eliminator » 15 Apr 2010, 20:04

Now It says:
{l Code}: {l Select All Code}
Main driveline missing, using first driveline as main!
Writing track file -->    Traceback (most recent call last):
  File "/home/jacob/.blender/scripts/Stk_track.py", line 1240, in savescene_callback
    exporter = TrackExport(sFilename)
  File "/home/jacob/.blender/scripts/Stk_track.py", line 1192, in __init__
    self.writeTrackFile(sPath, sBase, lCameraCurves)
  File "/home/jacob/.blender/scripts/Stk_track.py", line 441, in writeTrackFile
    f.write("<!-- Generated with script from SVN rev %s -->\n"%getScriptVersion())
  File "/home/jacob/.blender/scripts/Stk_track.py", line 37, in getScriptVersion
    return str(m.group(0))
AttributeError: 'NoneType' object has no attribute 'group'
Check out my YouTube, my FaceBook, and my Mods!
User avatar
eliminator
 
Posts: 36
Joined: 25 Mar 2010, 17:02

Re: Help with the track exporter scrip!

Postby Auria » 16 Apr 2010, 00:29

Seems like you did not define a main driveline; the script says it falls back, but maybe the fallback fails because it wasn't really tested; try giving the driveline the right property so that the exporter reckognises it straight away as the main driveline
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Help with the track exporter scrip!

Postby hiker » 16 Apr 2010, 13:38

Hi,

the driveline warning should probvably be fixed, but it doesn't cause the crash.

What does the __version__ string look like (line 11) - I think you have a different one from us. I've just committed a patch that should avoid this crash anyway (r5207).

Cheers!
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Help with the track exporter scrip!

Postby eliminator » 29 Apr 2010, 16:19

ok so do I download a new script or what?
Check out my YouTube, my FaceBook, and my Mods!
User avatar
eliminator
 
Posts: 36
Joined: 25 Mar 2010, 17:02

Re: Help with the track exporter scrip!

Postby Auria » 29 Apr 2010, 16:51

Along STK alpha 2, freshly released :D Or, on the wiki
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Help with the track exporter scrip!

Postby asciimonster » 30 Apr 2010, 08:19

The alpha2 exporter just gave a lot of these errors when run:
"Warning: quad has wrong orientation: p0=-5.324122 0.171031 -42.905258 p1=-7.0504
35 0.171028 -36.657780
The quad will be swapped, nevertheless test for correctness -
quads must be counter-clockwise oriented."

The minimap is completely messed up. Could you help me?
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby hiker » 30 Apr 2010, 13:29

asciimonster {l Wrote}:The alpha2 exporter just gave a lot of these errors when run:

I think you mean stk gave you the warnings (when using a newly exporter track) - the track exporter should export the quads correctly (and it does not print a warning ;) ).

...
The minimap is completely messed up. Could you help me?

Can you post or email your (compressed!) .blend file?

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Help with the track exporter scrip!

Postby asciimonster » 30 Apr 2010, 14:38

Here you go...
Attachments
Dishes12.7z
(209.96 KiB) Downloaded 489 times
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby hiker » 04 May 2010, 23:45

asciimonster {l Wrote}:Here you go...

Hi,

works for me (except for the missing textures ;) ). No error messages, no warnings.

Cheers,
Joerg

PS: Sorry for the late answer, turns out I only clicked on preview, and then forgot about that tab in the browser :(
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Help with the track exporter scrip!

Postby asciimonster » 09 May 2010, 21:19

Hiker,

I was trying to adapt the track exporter to write a materials.xml file. I cam up with this code:
{l Code}: {l Select All Code}
    # --------------------------------------------------------------------------
    # Writes the materials files, which includes all texture definitions
    def writeMaterialsFile(self, sPath, lObj):

        start_time = bsys.time()
        print "Writing material file --> \t",

        f = open(sPath+"/materials.xml", "w")
        f.write("<?xml version=\"1.0\"?>\n")
        f.write("<!-- Generated with script from SVN rev %s -->\n"%getScriptVersion())
        f.write("<materials>\n")

        # Iterate though all objects and collect those with material properies in them.
        lMaterialObjects = []
        lTempTextureNames = []
        for obj in lObj:
            mytexture = getIdProperty(obj, "mater-texture", "none")
            if mytexture<>"none":
                lMaterialObjects.append(obj)
                lTempTextureNames.append(mytexture)
       
        # Check for duplicate material definitions; throw warning if found.
        lTempTextureNames2 = []
        for sTextureName in lTempTextureNames:
            if sTextureName not in lTempTextureNames2:
                print "Warning, materials for texture '%s' are defined more than once. Please check the materials.xml file." %\
                    (sTextureName)
            else:
                lTempTextureNames2.append(element)

        # Write the materials to the file
        sMater=""
        for obj in lMaterialObjects:
            s=getProperty(obj, "mater-texture", "none")
            sMater = "name=\"%s\""%(s)
            s=getProperty(obj, "mater-transparent", false)
            if s: sSky="%s transparency=\"%s\""%(sMater, s)

        if sMater:
            f.write("  <material %s/>\n"%sMater)
           
        f.write("</materials>\n")
        f.close()
        print bsys.time()-start_time,"seconds"
        # ----------------------------------------------------------------------

Only thing is... It doesn't work (No data except the root node is written). Can you help?
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby hiker » 10 May 2010, 00:53

asciimonster {l Wrote}:
{l Code}: {l Select All Code}
 ...
        f = open(sPath+"/materials.xml", "w")

I assume that sPath is set properly? Is the materials.xml file created?

...
{l Code}: {l Select All Code}
        for obj in lObj:

I can't see how lObj is defined, since it's a parameter and I don't see where this function is called.
{l Code}: {l Select All Code}
            mytexture = getIdProperty(obj, "mater-texture", "none")
            if mytexture<>"none":

The "none" should be None (without quotes!) - avoids problems if someone sets the property to "none".

Does this help so far? Otherwise send/post the file and an example .blend file, but I will be away on holidays soon, so no idea when I will have time to look.

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Help with the track exporter scrip!

Postby asciimonster » 10 May 2010, 20:51

hiker {l Wrote}:I assume that sPath is set properly? Is the materials.xml file created?

Yes and yes
hiker {l Wrote}:I can't see how lObj is defined, since it's a parameter and I don't see where this function is called.

It's defined in __init__ as:
lObj = Blender.Object.Get()
Attachments
thecube19_test.7z
(411.2 KiB) Downloaded 524 times
stk_track.7z
(12.92 KiB) Downloaded 487 times
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby asciimonster » 10 May 2010, 23:01

Never mind. I fixed it myself.

Now I have to find a way to make it easier to enter them in blender. I am thinking of making it a comma separated list... :think:
*Ascii wonders off thinking and murmuring *
Attachments
stk_track.7z
(13.06 KiB) Downloaded 493 times
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby hiker » 11 May 2010, 02:02

asciimonster {l Wrote}:Now I have to find a way to make it easier to enter them in blender. I am thinking of making it a comma separated list... :think:
*Ascii wonders off thinking and murmuring *

I just remembered that blender supports adding new items to the space bar menu. Perhaps a separate little script that could be added to the space menu which adds all material default settings for an object. Or several new menu entries would do things like 'add type property', 'add transparency'?

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Help with the track exporter scrip!

Postby asciimonster » 11 May 2010, 19:44

I think it's better to create a stk version of the ID property browser (like we did with the b3d exporter).

I just noticed you can add properties to every object, every texture, every mesh etc. in the ID browser. We only need to hack a menu in there where one can add pre-fabbed and context-sensitive properties
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby asciimonster » 11 May 2010, 23:03

Oh, you are going to love this, hiker... :cool:

Here's a hacked version op the ID Property Browser. After you install it there's nothing much changed except a tiny little button. Good things really do come in small packages.

Best thing: It configurable by editing a single array in the top of the file. I assume you can take it from here... ;)
Attachments
IDPropBrowser.7z
(4.48 KiB) Downloaded 516 times
asciimonster
 
Posts: 375
Joined: 03 Dec 2009, 18:24

Re: Help with the track exporter scrip!

Postby hiker » 12 May 2010, 05:06

asciimonster {l Wrote}:Oh, you are going to love this, hiker... :cool:

Here's a hacked version op the ID Property Browser. After you install it there's nothing much changed except a tiny little button. Good things really do come in small packages.

Best thing: It configurable by editing a single array in the top of the file. I assume you can take it from here... ;)

Sounds great. I'll be on leave from tomorrow (and am therefore stressed out with last things to do at work atm), not sure when I will have time to have a look ... but I certainly will!

Thanks a lot!
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Who is online

Users browsing this forum: No registered users and 1 guest