DriveEditor - Vehicle Configuration (.jbeam) Editor GUI

Discussion in 'Utilities and programming' started by Trumple, Aug 17, 2013.

  1. Trumple

    Trumple
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    18

    (imported from here)

    DriveEditor allows for quick vehicle configuration, by editing the .jbeam files directly. In future updates, it will also allow you to add your own nodes. It is 100% free, and the download link is not monetized. I make these programs as a hobby!

    If you get a message about unable to parse a number of files, it's usually because the jbeam file is invalid (unless I've messed up somewhere). I found that a number of their configs are actually just broken (usually missing commas between array elements)
    I know that jbeam allows for missing commas in place of a newline, but sometimes they just forgot a comma on the same line. It was a massive headache! Luckily, most of their files are absolutely fine, so if you get more than a few files it can't parse, do let me know and I'll look into it.

    Features:

    • Auto saves as you type
    • Saves your BeamNG install as a setting, rather than hard-coded string. So when they release updates, and the install directory changes, you can just change the setting rather than wait for me to update.
    • Full jbeam parsing, to allow total flexibility of editing
    • Smart lookahead (so common config array structures (like 2-level arrays) will be presented in a multi-column format for easy editing, and the tree view for arrays will display the first element)
    • Type detection for boolean values (so that editing is a checkbox) and decimal/integers (so that saving them does not save them as a string, and maintains the original type)
    • Tab index to allow you to quickly move between edit boxes by pressing tab
    • Component creation by duplicating existing components
    • Custom node adding directly from the editor

    Planned features:
    • (done) Type detection (so numbers will be a number box, booleans will be a check box, etc.)
    • (done) Custom node adding (So you can create vehicles from within the editor)
    • (done) Tab index (So you can tab your way through values to edit them easily)

    Warnings:
    Comments will be stripped from the .jbeam files, and the layout of the file will be modified to JSON standard. Sorry about this. It can still be easily read and edited directly, but I do recommend backing up your vehicle folder just incase you want the old files back :) (though I'm inclined to think updating Drive would just re-download them if you want them again)

    Techie stuff:
    The config files are stored as .jbeam, which is some variant of JSON that I had lots of fun regex-ing to convert to valid JSON. I figured there is little point in making a parser for a format that is so similar to JSON. After it's been converted to valid JSON, the JSON parsed with the Json .NET library, and then loaded into a tree view (as you see on the left, above). Clicking on nodes will recurse and add all the top-level values to the editor, on the right, where they can be modified easily. As soon as the value in the box is modified, the JSON is re-created, and saved instantaneously.

    Update v0.5:
    Added node adding
    Improved performance in editing nodes by refactoring parts of the code

    (imported from here)



    Download link (see bottom of page):
    http://bitnode.co.uk/driveeditor-vehicle-config-editor-for-beamng-drive/#download

    REMEMBER: It will auto-save as you type, there is no save button! If you'd like one added, let me know and I'll update it


    Edit: I forgot to mention, just press "CTRL+R" while in game to reload the vehicle configs after editing!
     
    #1 Trumple, Aug 17, 2013
    Last edited: Aug 21, 2013
  2. Johnny-HH

    Johnny-HH
    Expand Collapse

    Joined:
    Aug 9, 2013
    Messages:
    22
    Looks like a very helpful tool, gonna try it.
    Thank you very much!

    -Johnny
     
  3. Trumple

    Trumple
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    18
    No problem, feedback is always appreciated if you do try it and find something could be done better!

    Thanks
     
  4. estama

    estama
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 7, 2012
    Messages:
    267
    Actually all commas are optional in jbeams, not just between lines.

    We have a python script that converts a jbeam (with optional commas) to JSON. The python script is essentially a wrapper for regexes, so that it can be easilly transferable to other languages too:

    Code:
    import re
    import sys
    import os
    
    for fn in sys.argv[1:]:
    	if not os.path.isfile(fn):
    		print "file not found: ", fn
    		continue
    	f=open(fn, "r")
    	j=f.read()
    	f.close()
    
    	j = re.sub(r'\r\n','<_NEWLINE_>',j)
    	j = re.sub(r'\n','<_NEWLINE_>',j)
    
    	j = re.sub(r'((?:(?:"[^"]*?"|-?[\d.]+[eE]?[+\-]?\d?)[\s\n]*:[\s\n]*(?:"[^"]*?"|-?[\d.]+[eE]?[+\-]?\d?|[\[{]|false|true|null))|"[^"]*?"|[\]\[{}]|-?[\d.]+[eE]?[+\-]?\d?|false|true|null)', r'\1,', j)
    
    	j = re.sub(r',([^[\]{}\\"\-\dtfn]*?),', r',\1', j)
    	j = re.sub(r',([^[\]{}\\"\-\dtfn]*?),', r',\1', j)
    
    	j = re.sub(r'\[,([^[\]{}"\-\dtfn]*?)\]', r'[\1]',j)
    	j = re.sub(r'\{,[^[\]{}"\-\dtfn]*?\}', r'{\1}',j)
    
    	j = re.sub(r'([[{]),(?=[^[\]{}]*?[[{"\-\dtfn])', r'\1', j)
    	j = re.sub(r'([\]}]),(?=[^[\]{}]*?[\]}])', r'\1', j)
    	j = re.sub(r'(["\-\dle]),(?=[^[\]{}"\-\dtfn]*?[\]}])', r'\1', j)
    	j = re.sub(r',$','',j)
    
    	j = j.replace('<_NEWLINE_>', '\n')
    
    	f=open(fn, "w")
    	f.write(j)
    	f.close()
    
     
    • Like Like x 1
  5. thevidmaster

    thevidmaster
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    202
    this is amazing! great work
     
  6. Trumple

    Trumple
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    18
    Thank you very much, I will incorporate these regex substitutions in the next update! Great to have support from the devs, I do appreciate it.
     
  7. dafour

    dafour
    Expand Collapse

    Joined:
    Nov 3, 2012
    Messages:
    32
    Like i said on fp,very handy tool,thx!
     
  8. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    nice work! :)
     
    • Like Like x 1
  9. Godzilla!

    Godzilla!
    Expand Collapse

    Joined:
    Mar 17, 2013
    Messages:
    2,243
    I tried to run this, but my avast! said it was a suspicious program, so it forced killed DriveEditor, I can't run it since it says it could has Malware or a Virus.
     
  10. dudes45

    dudes45
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    41
    AWESOME! Nice work, thanks very much this is a lot easier and more convenient than editing the files directly thanks a lot!!!
     
  11. xDecapitator

    xDecapitator
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    69
    Nice! This means that the community showroom should start filling up with working cars.
     
  12. pulley999

    pulley999
    Expand Collapse

    Joined:
    Jan 21, 2013
    Messages:
    825
    Add it to the list of exceptions, or disable your shields whenever you use the program.
     
  13. kyo89s

    kyo89s
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    10
    I think "create engine (based on current car)", "create transmission (based on current car)", "create a turbocharger (based on current car)" and "create a differential (based on current car)" buttons would be handy. Saving should be possible to separate .jbeam file for preserving modifications when the game update is called from the updater (that would otherwise overwrite modified ones).
     
  14. Trumple

    Trumple
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    18
    Awesome ideas! I'll add it to a growing list of "to-do"s :)

    So if I understand correctly, you'd be "inside" a file, like so:


    (imported from here)

    Then somewhere, there'd be a button to "create engine based on this engine", which would create something like "fullsize_engine_v8.jbeam", which in turn could be modified to your liking, while preserving the original jbeam AND all the required nodes in the custom jbeam. How does that sound? That could then be easily applied to any component, like wheels, etc.

    Thanks for all the feedback!
     
  15. Maj_Turbolag

    Maj_Turbolag
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    86
    Looks great. I can see this coming in very handy. Thanks! I will let you know of any issues when I find them.
     
  16. Richard.w2

    Richard.w2
    Expand Collapse

    Joined:
    Aug 6, 2012
    Messages:
    18
    It is possible to do from RWD to FWD?
     
  17. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    I cant seem to get to work the predefined path that the program comes up with C:\Users\joshu_000\AppData\Local\BeamNG\BeamNG-DRIVE-0.3\vehicles is not the correct path and I get an error BeamNG vehicle path is not valid. My correct path is C:\Users\joshu_000\AppData\Local\BeamNG\BeamNG.drive-0.3\vehicles and when I try to edit the path I cant delete the original path and put mine in it just wont let me lol. and when I pull up the drop down menu to change the path the APPDATA folder does not show up on the drop down menu. Do you know how to fix this Thanks for your help in advance Josh.
     
    #17 Josh, Aug 18, 2013
    Last edited: Aug 18, 2013
  18. Landie_Man

    Landie_Man
    Expand Collapse

    Joined:
    Aug 13, 2013
    Messages:
    191
    I wonder if you could blow the engine by increasing the RPM too much
     
  19. Trumple

    Trumple
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    18
    Hey Josh,

    So you can't type directly into the directory path setting box, which is why it won't let you manually change it. The reason AppData may not show up on your folder browser is because AppData is a hidden folder on Windows. It's an easy fix, though, just open up any folder (outside of DriveEditor), click "Organize" in the top left, then click "Folder and Search Options":

    (imported from here)

    Now just click the "View" tab at the top, then click "Show hidden files and folders":

    (imported from here)

    Then just hit "Apply" and go back into DriveEditor, click Options -> Settings -> Browse, then under Josh -> AppData -> Local -> BeamNG, you should see your install folder! Remember to select the "vehicles" folder inside it, not the BeamNG install folder!

    Hope that helps.
     
  20. bassjunkie

    bassjunkie
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    9
    thanks for this tool
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice