-
Notifications
You must be signed in to change notification settings - Fork 1
The TraitBlender API
This documentation provides comprehensive details on various aspects of the TraitBlender API, including functions, classes, and operators for controlling lights, backgrounds, and more. Refer to the table of contents for easy navigation.
- Mesh Generation
- World Background
- Background
- Lights
- Camera
- 3D Export
- Segmentation / Vertex Groups
- Other
TraitBlender is designed to streamline the process of 3D model generation and manipulation. Below is an overview of its various components.
Mesh generation is the foundation of TraitBlender. This section describes how TraitBlender generates the 3D meshes for models.
TraitBlender offers various options for setting the world background in your 3D scene. This section covers those features.
Property group for controlling sun related attributes in Blender.
Attributes:
strength (FloatProperty): The strength of the sun light.
# In Progress
This operator hides or unhides sun objects in the Blender scene.
Attributes:
bl_idname (str): Blender's internal name for this operator.
bl_label (str): The label for this operator.
bl_options (set): Options for this operator.
sun_names (StringProperty): Comma-separated names of sun objects to be hidden or unhidden.
# In Progress
This operator toggles the presence of sun objects in the Blender scene.
Attributes:
bl_idname (str): Blender's internal name for this operator.
bl_label (str): The label for this operator.
bl_options (set): Options for this operator.
distance (FloatProperty): Distance from the active object to place the suns.
# In Progress
This operator updates the strength of sun objects in the Blender scene.
Attributes:
bl_idname (str): Blender's internal name for this operator.
bl_label (str): The label for this operator.
bl_options (set): Options for this operator.
# In Progress
This panel provides controls for managing sun objects in Blender's UI.
Attributes:
bl_label (str): The label for this panel.
bl_idname (str): Blender's internal name for this panel.
bl_space_type (str): The space where this panel appears.
bl_region_type (str): The region where this panel appears.
bl_category (str): The category where this panel appears.
bl_context (str): The context in which this panel appears.
bl_options (set): Options for this panel.
# In Progress
Executes the operator, updating the strength of specified sun objects.
Parameters:
context: Blender's context object.
Returns:
dict: A dictionary indicating the execution status.
# In Progress
Draws the UI elements for this panel.
Parameters:
context: Blender's context object.
# In Progress
Lighting is crucial for bringing out the details in your 3D models. This section explains how TraitBlender handles lighting.
Camera settings are vital for capturing the right views of your 3D models. This section discusses the camera options available in TraitBlender.
TraitBlender supports multiple formats for exporting your 3D models. This section outlines how to export your projects.
This section provides details on how TraitBlender handles segmentation and vertex groups in your 3D models.
This section covers any additional features or settings in TraitBlender not covered in the previous sections.
Function to add the CreateBackgroundImageMeshOperator to the Blender mesh menu.
This function extends the mesh menu in Blender's UI to include an option for
creating a background image mesh. It adds an icon and the operator to the layout.
Parameters:
self: The current instance of the Blender layout.
context: The current Blender context, containing references to the active object and scene.
# In Progress
Update the distance of background planes relative to the active object.
This function adjusts the location of background planes to maintain a specified
distance from the active object in the Blender scene. It also rotates the planes
to face the active object.
Parameters:
self: The object that owns the function, typically an operator or a property group.
context: The current Blender context, which contains references to the active object and scene.
Returns:
None
# In Progress
Blender Property Group for controlling background plane settings.
This class defines properties related to the positioning and scaling
of background planes in Blender. It provides controls for expanding or
collapsing the background settings UI, setting the distance of the
background planes from the active object, and scaling the background
planes along the X, Y, and Z axes.
Attributes:
expanded (BoolProperty): Expand or collapse the background controls UI.
plane_distance (FloatProperty): Distance of the background planes from the active object.
plane_scale_x (FloatProperty): Scale of the background planes on the X axis.
plane_scale_y (FloatProperty): Scale of the background planes on the Y axis.
plane_scale_z (FloatProperty): Scale of the background planes on the Z axis.
# In Progress
Operator to trigger the update of background plane distances.
This class defines an operator that, when executed, calls the
'update_background_plane_distance' function to adjust the location
and orientation of background planes based on the active object in Blender.
Attributes:
bl_idname (str): Blender identifier for the operator.
bl_label (str): Label displayed in the Blender UI.
bl_options (set): Operator options defining its behavior in Blender.
# In Progress
Operator to create a background image mesh.
This class defines an operator that, when executed, creates a plane mesh
and assigns a specified background image as its texture. The plane's position
and orientation are also adjusted based on the active object in the Blender scene.
Attributes:
bl_idname (str): Blender identifier for the operator.
bl_label (str): Label displayed in the Blender UI.
bl_options (set): Operator options defining its behavior in Blender.
# In Progress
Operator to toggle the visibility of background planes.
This class defines an operator that, when executed, either hides or shows
the background planes in the Blender scene depending on their current state.
Attributes:
bl_idname (str): Blender identifier for the operator.
bl_label (str): Label displayed in the Blender UI.
bl_options (set): Operator options defining its behavior in Blender.
# In Progress
Operator to import a background image into the Blender scene.
This class defines an operator that, when executed, imports a background
image from a file and stores its reference in the scene properties for
future use.
Attributes:
bl_idname (str): Blender identifier for the operator.
bl_label (str): Label displayed in the Blender UI.
bl_options (set): Operator options defining its behavior in Blender.
filepath (StringProperty): Filepath for the image to be imported.
# In Progress
Operator to scale the background planes in the Blender scene.
This class defines an operator that, when executed, scales the background
planes based on the specified X, Y, and Z scaling factors stored in the
scene's background_controls property group.
Attributes:
bl_idname (str): Blender identifier for the operator.
bl_label (str): Label displayed in the Blender UI.
bl_options (set): Operator options defining its behavior in Blender.
# In Progress
Operator to toggle the visibility of background planes in the Blender scene.
This class defines an operator that, when executed, either creates or
removes background planes at specified distances from the active object.
These planes are textured with a background image if available.
Attributes:
bl_idname (str): Blender identifier for the operator.
bl_label (str): Label displayed in the Blender UI.
bl_options (set): Operator options defining its behavior in Blender.
distance (FloatProperty): The distance from the active object at which
the background planes will be created or removed.
# In Progress
Execute the operator.
This method is called when the operator is run. It scales the background
planes based on the X, Y, and Z scaling factors specified in the scene's
background_controls property group.
Parameters:
context: The current Blender context, containing references to the active object and scene.
Returns:
dict: A dictionary indicating the operator's status. Returns {'FINISHED'} if successful, or {'CANCELLED'} if an error occurs.
# In Progress
Invoke the operator.
This method is called to initialize the operator. It sets the distance
property based on the scene's background_plane_distance.
Parameters:
context: The current Blender context.
event: The event that triggered the operator.
Returns:
dict: The status of the execute method.
# In Progress
Maintainer: [email protected]
TraitBlender was created with the help and support of members of the Imageomics Institute.