cam.operators.operation_ops#
Fabex ‘operation_ops.py’ © 2012 Vilem Novak
Blender Operator definitions are in this file. They mostly call the functions from ‘utils.py’
Classes#
Add New CAM Operation |
|
Copy CAM Operation |
|
Remove CAM Operation |
|
Move CAM Operation |
Module Contents#
- class CamOperationAdd[source]#
Bases:
bpy.types.Operator
Add New CAM Operation
- execute(context)[source]#
Execute the camera operation based on the active object in the scene.
This method retrieves the active object from the Blender context and performs operations related to camera settings. It checks if an object is selected and retrieves its bounding box dimensions. If no object is found, it reports an error and cancels the operation. If an object is present, it adds a new camera operation to the scene, sets its properties, and ensures that a machine area object is present.
- Parameters:
context – The context in which the operation is executed.
- class CamOperationCopy[source]#
Bases:
bpy.types.Operator
Copy CAM Operation
- execute(context)[source]#
Execute the camera operation in the given context.
This method handles the execution of camera operations within the Blender scene. It first checks if there are any camera operations available. If not, it returns a cancellation status. If there are operations, it copies the active operation, increments the active operation index, and updates the name and filename of the new operation. The function also ensures that the new operation’s name is unique by appending a copy suffix or incrementing a numeric suffix.
- Parameters:
context – The context in which the operation is executed.
- Returns:
- A dictionary indicating the status of the operation,
either {‘CANCELLED’} if no operations are available or {‘FINISHED’} if the operation was successfully executed.
- Return type:
dict
- class CamOperationRemove[source]#
Bases:
bpy.types.Operator
Remove CAM Operation
- execute(context)[source]#
Execute the camera operation in the given context.
This function performs the active camera operation by deleting the associated object from the scene. It checks if there are any camera operations available and handles the deletion of the active operation’s object. If the active operation is removed, it updates the active operation index accordingly. Additionally, it manages a dictionary that tracks hidden objects.
- Parameters:
context (bpy.context) – The Blender context containing the scene and operations.
- Returns:
- A dictionary indicating the result of the operation, either
{‘CANCELLED’} if no operations are available or {‘FINISHED’} if the operation was successfully executed.
- Return type:
dict
- class CamOperationMove[source]#
Bases:
bpy.types.Operator
Move CAM Operation
- direction: EnumProperty(name='Direction', items='UP', 'Up', '', 'DOWN', 'Down', '', description='Direction', default='DOWN')[source]#
- execute(context)[source]#
Execute a camera operation based on the specified direction.
This method modifies the active camera operation in the Blender context based on the direction specified. If the direction is ‘UP’, it moves the active operation up in the list, provided it is not already at the top. Conversely, if the direction is not ‘UP’, it moves the active operation down in the list, as long as it is not at the bottom. The method updates the active operation index accordingly.
- Parameters:
context – The context in which the operation is executed.
- Returns:
A dictionary indicating the operation has finished, with the key ‘FINISHED’.
- Return type:
dict