rules_blender

Overview

Bazel rules for Blender

Setup

bazel_dep(name = "rules_blender", version = "{version}")

rules_blender

Rules

blender_export

load("@rules_blender//blender:defs.bzl", "blender_export")

blender_export(name, data, out, args, blend_file, format)

A Bazel rule for exporting scenes from a .blend file.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
dataAdditional files associated with the .blend file.List of labelsoptional[]
outThe name of the output file. If unspecified, the name of the target will be used.Stringoptional""
argsA mapping of parameter names to assignments to pass to bpy.ops.export_scene.gltfDictionary: String -> Stringoptional{}
blend_fileThe .blend file to export from.Labelrequired
formatThe format to export to.Stringoptional""

blender_toolchain

load("@rules_blender//blender:defs.bzl", "blender_toolchain")

blender_toolchain(name, blender, is_local)

Define a toolchain for Blender rules.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
blenderThe path to a Blender binary.Labelrequired
is_localWhether or not the toolchain is backed by a host installed Blender.BooleanoptionalFalse

Blender bzlmod extensions

Module Extensions

blender

blender = use_extension("@rules_blender//blender:extensions.bzl", "blender")
blender.local_toolchain(name)
blender.toolchain(name, urls, version)

Bzlmod extensions for Blender

TAG CLASSES

local_toolchain

An extension for defining a blender_toolchain backed by local install on the host. Note that this will only be instantiated for the root module.

Attributes

NameDescriptionTypeMandatoryDefault
nameThe name of the toolchain.Namerequired

toolchain

An extension for defining a blender_toolchain from a download archive.

Attributes

NameDescriptionTypeMandatoryDefault
nameThe name of the toolchain.Namerequired
urlsUrl templates to use for downloading Blender.List of stringsoptional["https://download.blender.org/release/Blender{major_minor}/blender-{semver}-{platform}.{extension}"]
versionThe version of Blender to download.Stringoptional"4.5.1"