Contributing
Blender Addon Structure
The Blender addon is a series of Python files in the extension
directory.
__init__.py
is the entrypoint to the entire addonsblender_manifest.toml
contains the packaing information for the addon- The
operators
directory contains a number of Blender Operators, one per file. skein_panel.py
is the Panel UI for Objects, Meshes, and Materialsgltf_export_extension
is the glTF export extension code that handles setting the glTF extrasproperty_groups.py
is the core of the Component's data.form_to_object.py
is basicallyPropertyGroup.to_json()
(this "to_json" doesn't exist afaik)
The Workflow
Workflow-wise, FetchBevyTypeRegistry
must be run to fetch the Bevy registry data, which means it must be the first action before being able to insert and modify Component data on objects.
FetchBevyTypeRegistry
will store the result of a Bevy Remote Protocol request in a skein-registry.json
text file. Future opens of the .blend
file will load the registry data from skein-registry.json
instead of needing to make a BRP request.
Processing the Registry
After gaining access to the registry information, we build PropertyGroup
s dynamically for every single Component type and, because Blender Properties require static typing and don't support rich enums, we build out a large container type that contains a field for every single Component type. The container component type stores information about which Component it is supposed to represent, which is then used to pick the right fields to display in the UI.
Having this large container type allows us to set up a CollectionProperty
that can support multiple Components.
Inserting Components on Objects, Meshes, or Materials is as easy as inserting one of these container types into the Components CollectionProperty
on the object, mesh, or material.
The Skein Panel UI
The SkeinPanel will then introspect the data in the CollectionProperty
's PropertyGroup
s to build forms for the selected Component data.
Using these PropertyGroup
s is what allows us to take advantage of Blender features like Drivers and Library Overrides.