2.4 KiB
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 capitalized - Functions, modules, variables, etc are
named_like_this
- spaces replaced with underscores, no capital letters - No
*
imports - e.g.from module import *
should be rewritten to specify exactly what is being imported -from module import Class, function, variable as other_name
etc.
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,
utilities
are at the lowest level - they depend on external libraries (e.g.:bpy
,shapely
,numpy
etc) and are used to power the other classes and functions - Second, are all the files in the main addon folder (e.g.:
cam_chunk
,gcode_path
,strategy
) and they use external libraries, as well asutilities
to power Blender's functions - Third,
properties
,operators
andui
are Blender classes that useutilites
and the main files to integrate Fabex functions into Blender
The rest of the files can be considered references:
post_processors
andpresets
will be loaded based on user selections in Blendertests
contains automated testing functions related to Github Workflows (see the Testing page for more details)wheels
conatins the pre-built Python binaries that power the external dependenciesshapely
andopencamlib
- they are loaded automatically by Blender