• Dear visitors,

    The email issue has been finally solved.
    Thank you for your patience and happy browsing.

    Team ACM.

RELEASED-wip Blender Track Tools

nendo

New Member
I'm in the process of writing a toolkit for track building in Blender and I was hoping I could drum up some people to test it while I continue adding features.

Before I get into features, the add-on can be downloaded here: https://github.com/nendotools/ac-track-tools/releases

Objectives
The main goal is to move as many configuration steps into one place as possible, provide meaning guardrails and default values, and reduce the risk of errors between building and importing your tracks.

Features
At the time of this post, the add-on currently supports many of the essential features for building a standard track.

Project Options

- set working directory (automatically generates folder structure under project directory)
- save/load settings (creates ini and json files)
- preflight checks
- checks for issues with track configuration and flags them for review
- 3 levels of issues can be flagged
- notice: not breaking, but may be a mistake
- warning: a breaking issue that can be auto-fixed by the preflight tool
- error: a breaking issue that must be manually resolved
- Export Track: uses the fbx add-on with pre-baked settings

Track Settings

This section exposes options for the track json file. note: pitboxes can be manually entered or automatically resolved using the preflight tool.

Surfaces

This section exposes options for managing surfaces for your track. The default 4 surfaces cannot be modified directly, but they can be copied and overwritten.
- copy surfaces options to new surface
- select all objects using surface
- all surface options (some hidden based on surface options, valid track cannot have black flag time)
- remove surface (does not remove track pieces using that surface)
- create new surface
- all surfaces on this list can be applied to selected objects from the context menu

Audio

The audio section exposes options for reverb zones and SFX emitters.
- assign to track node or emitter (requires a valid AC node name)
- utilize preset reverb settings

Lighting

This menu mixes the basic lighting.ini settings and some options from the extension.ini file. Some of the sun settings don't really work the way I originally expected, but I don't think it really matters if you're using weather mods. I haven't really tested to find out, though.

Context and Gizmos

I've added a lot of actions to the context menu to easily assign surfaces and create various track nodes. I'm also in the process of creating visual indicators for the various track nodes to more easily determine their position and direction.

I'm hoping this will reduce the barrier for entry into track making and cut out some of the more annoying aspects of the whole process. It'll still be important to understand the underlying requirements to track creation (such as file structure, map images, kn5 conversion, etc), but I'll continue to automate as much of that as I'm able to...

If you've got any questions/suggestions, feel free to leave a comment.

The github repo can be found here.
 

luchian

Administrator
Staff member
It's an interesting idea. Time and coding skills do not allow me to contribute atm, but will be following from afar. Good luck!
 

Carl Ahearne

New Member
This looks great! I'll have to give it a go when I get some time.

I need to take some time to learn to write Blender addons; there are so many tasks that I do all of the time that I'd love to be able to do with 1 click instead of loads. Example: Creating Kerbs. I create the mesh, then I do the following steps so many time:

1. Array the mesh along a curve (Click Add Array, Change to Fit Curve, Select Curve)
2. Curve (Click Curve Modifier, Select Curve, which is the same as the curve above)
3. Somertimes Switch the direction of the curve.

I'd love for that to be simple; click the mesh, add the 'Do Everything' Modifier and select the curve. Tick a box if the curve direction needs to be switched. 3 clicks instead of about 10 would save hours!
 

nendo

New Member
I need to take some time to learn to write Blender addons; there are so many tasks that I do all of the time that I'd love to be able to do with 1 click instead of loads.
Blender's add-on API uses python. So, it should be pretty easy to jump into if you've got some programming background. Definitely use the manual (it's fairly good for key features like Operators and UILayouts). I actually started doing it as a way to learn Python.

Also, I thought your prompt sounded easy/useful. Here's some code. Just save it to a file and put it in your addons folder. It'll add a "Quick Curve" option to your Object header menu.

Code:
from bpy.types import Operator, Context, Object, VIEW3D_MT_object
from bpy.utils import register_class, unregister_class

bl_info = {
    "name": "Quick Curve",
    "blender": (2, 80, 0),
    "category": "Object",
}

class QUICKCURVE_OT_quick_curve(Operator):
    bl_idname = "object.quick_curve"
    bl_label = "Quick Curve"
    bl_options = {'REGISTER', 'UNDO'}

    # these properties will be used to store the selected curve and mesh
    curve: Object
    mesh: Object

    def execute(self, context: Context):
        # get the selected objects from current context
        objects = context.selected_objects
        for obj in objects:
            if obj.type == 'CURVE':
                self.curve = obj
            if obj.type == 'MESH':
                self.mesh = obj

        # if the curve or mesh is not found, return CANCELLED to stop the operator
        if self.curve is None or self.mesh is None:
            return {'CANCELLED'}

        # create the array modifier and set the curve as the target
        mod = self.mesh.modifiers.new(name='Array', type='ARRAY')
        mod.fit_type = 'FIT_CURVE'
        mod.curve = self.curve
        mod.use_merge_vertices = True

        # create the curve modifier and set the curve as the target
        mod = self.mesh.modifiers.new(name='Curve', type='CURVE')
        mod.object = self.curve
        return {'FINISHED'}

    @classmethod
    def poll(cls, context: Context):
        # only show the operator if there is a curve and a mesh selected
        return all(obj.type in {'CURVE', 'MESH'} for obj in context.selected_objects) and len(context.selected_objects) == 2

def menu_layout(self, context):
    self.layout.operator('object.quick_curve')

def register():
    # register the operator and add it to the object menu
    register_class(QUICKCURVE_OT_quick_curve)
    VIEW3D_MT_object.append(menu_layout)

def unregister():
    # remove the operator from the object menu and unregister it
    VIEW3D_MT_object.remove(menu_layout)
    unregister_class(QUICKCURVE_OT_quick_curve)
 

Carl Ahearne

New Member
@nendo That worked a treat! I tried to write something with the help of ChatGPT but it was having some issues and I'm not a coder so I couldn't quite get to the bottom of it. This will save me hundreds of mouse clicks!
 

nendo

New Member
@Carl Ahearne happy to help! Just don't try and apply the curve twice. I didn't add any checks for existing modifiers! :whistle:

ChatGPT is okay for simple stuff, but it's very clumsy with more specific requests like this.
 

nakoustix

New Member
@nendo Thank you very much for the effort!
I'd like to contribute, if I can.

I already sent a pullrequest for a small fix regarding casting of boolean types when reading surfaces.ini.
Probably that pattern should be used elsewhere.

I'd like to assist in developing this further and making it the GOTO Blender2AC tool out there, if you're still interested in this project! :)

I'm proficient in blender and coding (C, C++, C#)
However, I need to first overcome my deep hatred for python (ughhh) and learn to accept it as what I already know it is: a potentially powerful programming language.

kudos and cheers
Michael
 

nendo

New Member
@nakoustix I appreciate the offer to help. I took a bit of a hiatus from some of my side projects due to some personal matters, but I'm open to having more contributors as I ramp back up on this.

I'll keep an eye out for more PRs and provide some code reviews/guidance where needed.

As for the language... well, I also felt like Python was a pretty bad one, even more loose and clunky than JavaScript... but it's not so bad once you get used to it and actually apply types where possible. I need to upgrade this repo to use ruff for linting/formatting. It's on my personal to-do list.
 

nakoustix

New Member
@nendo Hey that's okay. We all have our lifes and then our sideprojects on second or third priority. I can't predict hown much enery I'll put into this either.

Yep, I'll see where this gets me. It's time to suck it up and learn it. I'm clearly NOT against python because I have co-workers doing crazy shit with it.
I have done experiments with it since python2 but always fell back to the C's and never learned it properly :/

Using Ruff sounds great! I'm so used to advanced IDE features that it might be a factor as well in neglecting python.
 
Top