1. Stuck or having problems creating your mod?

WIP JBeam Maya Tools

Discussion in 'Utilities and programming' started by BHowie, Sep 10, 2019.

  1. BHowie

    BHowie
    Expand Collapse

    Joined:
    Sep 6, 2019
    Messages:
    4
    This will be my attempt at some modding tools mostly revolving around Maya as the main DCC tool. The goal with this set of tools is to (hopefully) beable todo all the editing for a car mod in Maya without having to edit jbeam files.

    I have it setup as Nodes == locators, Beams == curves. Currently I have some code working that will generate these structures from a mesh.

    Manual editing would be done by moving, creating, editing locators, connecting, deleting beams to locators, etc..

    Color coding would also likely be super useful.

    As of now I’ve got the basics working and loading into BeamNG. There are issues with getting meshes because maya’s default axis-up but there are some easy workarounds during publishing to fix that.

    I’ll be updating the source code that can be found on GitHub here: https://github.com/bhowiebkr/jbeam-maya-tools


     
    • Like Like x 3
    • Staff Pick Staff Pick x 1
  2. JDM_Drifter

    JDM_Drifter
    Expand Collapse

    Joined:
    Sep 8, 2019
    Messages:
    1
    This blows me away.
     
  3. BHowie

    BHowie
    Expand Collapse

    Joined:
    Sep 6, 2019
    Messages:
    4
    The jbeam files are super buggy. There are so many edge cases of missing or improper encoding.

    Devs, why not just use json to validate from the gekko. Than extend it with comments and other extra features to make the jbeam format way easier to parse. It would make creating modding tools much easier.

    Here is a list of my regular expressions to convert official jbeam files to json, or see testing_convert_regex.py on my repo.

    total: 1237, converted: 1225, invalid: 12

    Code:
    # single line comments
    j = re.sub(r'\/\/.*', r'', j)
    
    # multiline comments
    j = re.sub(r'/\*[\s\S]*?\*/', '', j)
    
    # Missing comma between brackets
    j = re.sub(r'(\]|})\s*?(\{|\[)', r'\1,\2', j)
    
    # Add expected comma between } or ] and "
    j = re.sub(r'(}|])\s*"', r'\1,"', j)
    
    # Adding expected comma between " and {
    j = re.sub(r'"{', r'", {', j)
    
    j = re.sub(r'"\s+("|\{)', r'",\1', j)
    
    # add comma between bool keys
    j = re.sub(r'(false|true)\s+"', r'\1,"', j)
    
    # remove doubled comma's
    j = re.sub(r',\s*,', r',', j)
    
    # add comma between numbers and numbers or [
    j = re.sub(r'("[a-zA-Z0-9_]*")\s(\[|[0-9])', r'\1, \2', j)
    
    # Add a comma between number and {
    j = re.sub(r'(\d\.*\d*)\s*{', r'\1, {', j)
    
    j = re.sub(r'([0-9]\n)', r'\1,', j)
    
    # Remove trailing comma
    j = re.sub(r',\s*?(]|})', r'\1', j)
    
    # single line comments
    j = re.sub(r'\/\/.*', r'', j)
    
    # add comma between numbers with spaces ie: 333 333 = 333, 333
    j = re.sub(r'([0-9])\s+([0-9])', r'\1,\2', j)
    
    # Add comma between number and "
    j = re.sub(r'([0-9])\s*("[a-zA-Z0-9_]*")', r'\1, \2', j)
    
    # missing comma between "bla""bla"
    j = re.sub(r'("[a-zA-Z0-9_]*")("[a-zA-Z0-9_]*")', r'\1, \2', j)
    
    # missing quotation on value in "bla": "bla
    j = re.sub(
        r'("[a-zA-Z0-9_]+"):(\s*"[a-zA-Z0-9_]+:)(\n\s*"[a-zA-Z]+")', r'\1:\2",\n\3', j)
    
    

    Has anyone built a python converter that is 100% successful I can adopt?
     
  4. BHowie

    BHowie
    Expand Collapse

    Joined:
    Sep 6, 2019
    Messages:
    4
    I've gotten the invalid jbeam files down to 4. See prior github link

    total: 1237, converted: 1233, invalid: 4
    Code:
    # broken jbeam files are
    ['etk800', 'etk800_body_wagon', 'etkc', 'sbr_electric']
    
    These files have the same multi-line error with missing
    quotation and wrong bracket position. Easier to fix manually for those files.
    --- Post updated ---
    All jbeam files successfully convert to json.
    total: 1237, converted: 1237, invalid: 0

    Last bug was due to single line comment matching inside of strings where file paths sometimes are.
     
  5. ThreeDTech21

    ThreeDTech21
    Expand Collapse

    Joined:
    Sep 27, 2013
    Messages:
    1,502
    I'm curios, are you making an importer or exporter or both?
     
  6. BHowie

    BHowie
    Expand Collapse

    Joined:
    Sep 6, 2019
    Messages:
    4
    Mostly just an exporter, but building the importing functionality is an easy way to figure out how everything should be structured in the scene. I'm hoping that as long as I keep the organization similar to how it came in, I should beable to export it all back out.

    The basics of loading beams, nodes, meshes now working.



     
  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