Blender Addon

Discussion in 'Content Creation' started by Khalibloo, Aug 6, 2018.

Tags:
  1. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    Hello, I'm new to the community and never actually used BeamNG drive. I was once drafted to develop a Blender addon to simplify content creation (specifically jbeam files) but the project was canceled by the client.
    The addon is basically an interface within Blender that allows you to enter values for each of the jbeam properties and then exports it in the end.

    I've just now decided to release the addon with the hope that someone might still find it useful. But keep in mind, it was never tested and I'm not a BeamNG user myself, so I can't actually test it. However, if needed, I can make adjustments from time to time based on recommendations from you experts.

    The addon can be found over on Itch https://khalibloo.itch.io/beamng-drive-blender-addon
    The source code is hosted on Bitbucket https://bitbucket.org/Khalibloo/beamng.drive-blender-addon/src/master/
     
    • Like Like x 21
  2. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,123
    Hmmm... sounds interesting... it's too late today, but I might try and give this a go tomorrow.
     
  3. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    Sure thing. In the mean time, here are some screenshots.






    So it's basically just an interface for creating jbeam files from meshes.
     
    • Like Like x 2
  4. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,779
    How challenging it would be to make import of the jbeam nodes and beams to Blender?

    Often when making jbeam structure, one wants to edit it later, but as jbeam structure contains lots of other stuff, like node groups, deform groups, etc. it can be bit of work to change one value, then needing to implement all of other stuff back in.

    Some data would be useless for Blender, but would still need to be retained between importing and exporting, to be able to skip manual adjusting of the files.

    This project has importing and exporting of whole file, which might give an idea how involved it might get:
    https://github.com/RORMasa/NodeBeamEditor/releases
     
  5. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    That's interesting. It shouldn't be too hard, but a little time-consuming. It's essentially the reverse of the export process. I could begin work on that once I feel the export process is sufficiently tested. This is to avoid having to keep track of both pipelines while potentially major changes are still being made.

    Oh, I guess there are other addons for exactly this already. I'll look into it. Thanks for sharing.
     
    • Like Like x 2
  6. TheDiamondLord8

    TheDiamondLord8
    Expand Collapse

    Joined:
    Jan 2, 2017
    Messages:
    2,012
    Looks cool and useful (if I could probably figure how to use it)! I'll watch this thread.
    --- Post updated ---
    So how do you use it? I have it installed?
     
  7. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    Yes, you'll have to download the zip file and install it. One way to do that is to extract it and copy it into your Blender addons folder. Then you simply enable it in your user preferences. The process is similar to regular Blender addons. After installing it, you should see it in Blender's right panel (the N-Panel).

    It works by tagging objects as a beamng type. An object can be a "flexbody", "skeleton", or nothing. So once you select a mesh, you can tag it as a skeleton for example, to reveal the options to populate the jbeam file. It breaks down the sections of the jbeam file into different tabs. The screenshots above show some of the contents of the tabs. If you've worked with jbeam files, their options should look familiar.

    You move from tab to tab filling in the necessary information. The Nodes, Beams and Coltris tabs allow you to assign vertices, edges and faces to different groups when you go into edit mode. You can name the groups and assign values for their properties. When all that is done, you export your jbeam file using the large button above. The addon also takes care of assigning left, middle and right nodes using the prefixes you provide. This is done based on the object's local X axis.

    I recommend going over the structure of the jbeam file in the documentation here, to get a general understanding of its structure.

    Edit:
    I should also mention that there are currently some parts of the jbeam specification that have not yet been implemented. The main missing features are refnodes and paired nodes. You should always verify the saved jbeam file for correctness.
     
    #7 Khalibloo, Aug 7, 2018
    Last edited: Aug 8, 2018
    • Informative Informative x 2
  8. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,779
    There is one addon, but yours is certainly far more advanced with more features.

    Sadly there is nothing that currently imports jbeam to Blender, that feature would be huge help for community, at least in my opinion and certainly I will pay at least 20 euros from such, surely some others might be willing to add little something as that would save a LOT of time, when you can import for example suspension setup to blender, move things around, export, test and repeat.
     
  9. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    I can see how that would be very time-saving. I'll prioritize import next.
     
    • Like Like x 2
  10. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,123
    Well it sounds like this guy has the skills to make this really great. We have the JBeam knowledge... Perhaps we can help each other to make your tool the best out there (although from what I am seeing already, its kinda already there) as I too would be willing to donate for something that can help this well.

    Way back in the day, there used to be an importer for RoR (the game before BeamNG) that could import the files into blender, modify them, and then export them again. As the game got more complicated and the files had more and more features in them, the less and less helpful the tool became as the tool basically only preserved everything above the Nodes, Beams, and Tris sections... if anything came after them, or there were any settings applied in the file (like beam strength or node weights and stuff like that) it would all get deleted. Naturally that is extremely annoying.

    So for an Importer/Exporter to be the best it can be, I would imagine it would need to be able to Import, read, and identify the parts of the file it would be allowed to modify and what it would have to leave untouched by the editor (we could change stuff from within the text editor in blender... perhaps). So it would need to have the whole JBeam file of the particular part your working on loaded the whole time you were in blender modifying it.

    Also, to keep things from messing up, it would need to read all the node numbers in and then keep each vertice as that node number. One of the current issues with the original Blender Node/Beam exporter is that if you change the position of some of the nodes too drastically, it will renumber the entire JBeam which, in turn, basically cancels out any extra Beam work you did interconnecting JBeams as those beams that you added in manually don't get exported via the Blender addon (obviously I guess... they were added outside of it so how would it even know about them). A long time ago, again, back in the RoR days, someone modified that importer/exporter to be able to not only hold the node numbers (at the time it was just numbers and not names like we have in BeamNG) and actually display them inside Blender. That was super useful in terms of just making sure that everything wasn't going to get all messed up when you exported your car.

    It took me a while to find it... unfortunately it comes pre packaged with a really old version of Blender, so actually viewing the addon may be a pain... but at least there is a picture at the link so you can see what I am on about.

    http://docs.rigsofrods.org/tools-tutorials/visual-editors/#blender-249b
     
    • Informative Informative x 3
  11. Ovahlls

    Ovahlls
    Expand Collapse

    Joined:
    Jun 11, 2016
    Messages:
    149
    Holy heck I know all mod makers could use that.
     
    • Like Like x 2
    • Informative Informative x 1
  12. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    @atv_123,
    Thank you for that deep insight. My approach to the import procedure does not account for restricting access to certain parts of the file. It would simply load all the nodes, beams and coltris and produce a mesh out of those. Then the remaining properties in the file would be attached to the object in the same way the addon currently works. This will cover the full jbeam specification, so all fields within the jbeam file will ideally be imported into the object. The user can change the properties as needed without any restrictions and then re-export the full jbeam file in the end.

    At least that's how I envisioned it. Do you think there's a use case where this would be a bad thing? Do users typically add properties outside of the jbeam specification? Besides comments I mean. If there's a use case to be accounted for, I can figure out a solution to preserve the extra properties in the jbeam.

    Trying to preserve node numbers can open up the door to a lot of different kinds of errors. Since the values are stored on the vertices themselves, operations such as extrude and split can lead to duplicate node IDs. However, using the approach I described, the beam relationships will still be preserved even if the node numbers change. That wouldn't be an issue at all even if you did manual work on the beams or triangles.

    I do very much like the idea of being able to visualize the node names in edit mode. I'll look into that soon.
     
    • Like Like x 3
  13. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,779
    I wonder if it is possible to color code edges in Blender?

    Often it can be bit challenging to actually see beams inside the game because there is so much, but in game there is possibility to color beams which helps a lot.

    I think that coloring of beams is not documented in Wiki articles, it can be inline with the beam definition or as it own line like this {"highlight":{"radius":0.0075, "col":"#FFFF005f"}} . There can be some other bits that are not fully documented, but can't remember much right now.

    As you don't have BeamNG, it might be helpful to see some files and maybe they are useful for testing.

    Attached are few files, balama_drift is jbeam from Automation exported vehicle's main jbeam file, suspension_F is front suspension of that vehicle.

    hopper_body is vanilla car's body, suspension file is front suspension, those files work together, so that some beams hold suspension in place and beams from front suspension file connect to body nodes which are defined in body jbeam.

    Now if node naming changes, it would need to be changed in all files and there are quite few parts, so node naming would be quite important to be maintained from import to export.
     
    #13 fufsgfen, Aug 8, 2018
    Last edited: Nov 15, 2018
    • Informative Informative x 1
  14. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,123
    Hmmm... Well that way you describe should work... But yeah, a lot of outside work can end up going on outside of an editor... unless the editor is absolutely epic and can cover ALL aspects of a JBeam file. For example:

    I currently do all of my JBeam work in Blender as it is just the fastest way to lay out nodes/beams (especially since I am so used to it... so that definitely helps). When I export it the first time into my files, I just copy all my nodes/beams over into my main file to test. Once I nail down everything I want, I can then start interconnecting all the nodes from the first JBeam to the next JBeam.... for example... connecting a bumper to a frame. In Blender, I have a bumper, and a frame. Two different meshes in blender that can't be interconnected in any way (that I am aware of) but in the game, in order to be connected, some extra beams needed to be created manually to interconnect the two... these are the beams that always end up getting messed up if you go back later to make a change to the JBeam structure as they aren't included in the Blender export. The easiest way to deal with this (I guess) would be if it were actually possible to connect edges between vertices on different models in blender.

    The only other way I could see it working would be to make all the JBeams 1 single mesh and splitting all the different JBeams into their own vertex groups (as you mentioned earlier)

    If need be I could make you a very simple JBeam vehicle to see what I am talking about. Those interconnected beams are going to be the hard ones.

    The cheater way to combat that I guess could be to take any node name, search for it through all the JBeam files, and then change that node name to the new node name blender creates every time it shows up. That could possibly work.
     
    • Agree Agree x 1
    • Informative Informative x 1
  15. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    @fufsgfen,
    Ah I see... So node names are used across different files. I'll need to find a way to maintain node names then. And I can see from those samples that there are a lot of properties that were not documented on the wiki indeed. And even the node groups were specified in a different way than described in the wiki. It will be difficult to handle all the jbeam properties in that case. So I'll add an extra field to store the undocumented properties. The field will be visible as a text box so that the user can delete its content if it's no longer needed. Comments will be lost, however. I think those are a necessary sacrifice, because they are completely invisible to the parser. Thanks for those samples they will be very useful in testing.

    Edit:
    As for coloring, Blender does not expose a way to color edges. This is handled in the theme. The visualization method at the bottom of this post could be adapted to handle colors, but it is a very slow process. Visualizing a suzanne mesh takes well over a minute on an Intel Core i7. The good thing is that collision meshes tend to be simple meshes, though.

    @atv_123,
    I get it now. I didn't consider that nodes could be referenced outside of the object. Apart from maintaining the node names, I will eventually look into simplifying the linking process. Vertex groups could be used, but there's a cleaner method I experimented with some time ago. It avoids some of the complications of using vertex groups by ensuring a one-to-one relationship, not with node names, but with vertices themselves. Here, I have a function that can take a mesh and generate a bunch of empties and curves visualizing nodes, beams and triangles.

    This was generated from a simple icosphere.The links are maintained in realtime if the vertices move. This can be modified to help maintain the links between nodes across objects.
     
    • Like Like x 3
  16. burilkovdeni

    burilkovdeni
    Expand Collapse

    Joined:
    Aug 21, 2014
    Messages:
    1,112
    When I use this exporter could I theatrically rename all the vertices???

    Like i make jbeam mesh in blender and then I go into your exporter's GUI click all of the vertices and rename them from some random number to lets say I am doing a hood, I would the name all of the vertices to: hd1rr, hd1r, hd1, etc...
     
  17. Khalibloo

    Khalibloo
    Expand Collapse

    Joined:
    Aug 6, 2018
    Messages:
    19
    The way it currently works is that you provide a set of prefixes. For example, mid for the middle vertices, r for right vertices and so on. Then it uses the vertex IDs and the prefixes to name all the nodes for you. So you end up with mid0, mid1, r2, and so on. It does not allow for individual naming of vertices. Now that we're discussing the way the import system should work, depending on how we go about it, it may be helpful to allow individual naming of vertices. I can guess that node naming flexibility is very important now that I know they are used across objects. But do you think there's another reason this feature should be included?
     
    • Like Like x 2
  18. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,779
    I did made first payment of $24 of this and I hope to make more payments as my funds allow until end of the year (should be at least $12 each month), so Khalibloo will get at least something out from his troubles, hope someone else can make small donation too as it will take some time from Khalibloo to make this tool and time of professionals is valuable, tool will save so much of my time that it certainly warrants a payment :)

    Maybe it is not quite the income full contract job would get, but at least little something :)
     
    • Like Like x 1
  19. iplaybeam

    iplaybeam
    Expand Collapse

    Joined:
    Dec 16, 2017
    Messages:
    285
    After reading the post, this seems useful, expectantly for a new modder like me. But maybe post a tutorial video as reading a bunch of text is not for me.
     
  20. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,779
    But in BeamNG modding, one of most common things you will do is reading walls of text? o_O (of course banging head to wall is the most common thing, while mumbling why it does not work, it should work being good 2nd).
     
    • Like Like x 3
  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