Style Guide#
As a Blender extension, Fabex follows the guidelines laid out by the Blender Foundation:
In short, Blender uses a modified version of the pep8 standard, meaning:
Classes are
NamedLikeThis- no spaces, all words capitalizedFunctions, modules, variables, etc are
named_like_this- spaces replaced with underscores, no capital lettersNo
*imports - e.g.from module import *should be rewritten to specify exactly what is being imported -from module import Class, function, variable as other_nameetc.
Fabex extends the default line-length to 100 to allow some of the longer equations to remain on a single line.
An auto-formatter, Black, has been implemented to ensure code consistency across contributions. It will ensure that your spacing, indentation etc are in line with the project guidelines.
Most Code Editors/IDEs are able to integrate the Black formatter, so you can format your code while you work.
Project Structure#
Fabex is a huge addon, with many different functions, added by many different contributors over the course of 12 years of development!
In order to avoid conflicts, bugs and import errors a hierarchy has been established:
First,
utilitiesare at the lowest level - they depend on external libraries (e.g.:bpy,shapely,numpyetc) and are used to power the other classes and functionsSecond, are all the files in the main addon folder (e.g.:
cam_chunk,gcode_path,strategy) and they use external libraries, as well asutilitiesto power Blender’s functionsThird,
properties,operatorsanduiare Blender classes that useutilitesand the main files to integrate Fabex functions into Blender
The rest of the files can be considered references:
post_processorsandpresetswill be loaded based on user selections in Blendertestscontains automated testing functions related to Github Workflows (see the Testing page for more details)wheelsconatins the pre-built Python binaries that power the external dependenciesshapelyandopencamlib- they are loaded automatically by Blender