kopia lustrzana https://github.com/vilemduha/blendercam
Docstring update - change 'camera' to 'CAM' where applicable
rodzic
92b5c97f8d
commit
c82f18044c
|
@ -22,12 +22,12 @@ class CamBridgesAdd(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation in the given context.
|
||||
"""Execute the CAM operation in the given context.
|
||||
|
||||
This function retrieves the active camera operation from the current
|
||||
This function retrieves the active CAM operation from the current
|
||||
scene and adds automatic bridges to it. It is typically called within
|
||||
the context of a Blender operator to perform specific actions related to
|
||||
camera operations.
|
||||
CAM operations.
|
||||
|
||||
Args:
|
||||
context: The context in which the operation is executed.
|
||||
|
|
|
@ -20,10 +20,10 @@ class CamChainAdd(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera chain creation in the given context.
|
||||
"""Execute the CAM chain creation in the given context.
|
||||
|
||||
This function adds a new camera chain to the current scene in Blender.
|
||||
It updates the active camera chain index and assigns a name and filename
|
||||
This function adds a new CAM chain to the current scene in Blender.
|
||||
It updates the active CAM chain index and assigns a name and filename
|
||||
to the newly created chain. The function is intended to be called within
|
||||
a Blender operator context.
|
||||
|
||||
|
@ -59,10 +59,10 @@ class CamChainRemove(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera chain removal process.
|
||||
"""Execute the CAM chain removal process.
|
||||
|
||||
This function removes the currently active camera chain from the scene
|
||||
and decrements the active camera chain index if it is greater than zero.
|
||||
This function removes the currently active CAM chain from the scene
|
||||
and decrements the active CAM chain index if it is greater than zero.
|
||||
It modifies the Blender context to reflect these changes.
|
||||
|
||||
Args:
|
||||
|
@ -92,13 +92,13 @@ class CamChainOperationAdd(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute an operation in the active camera chain.
|
||||
"""Execute an operation in the active CAM chain.
|
||||
|
||||
This function retrieves the active camera chain from the current scene
|
||||
This function retrieves the active CAM chain from the current scene
|
||||
and adds a new operation to it. It increments the active operation index
|
||||
and assigns the name of the currently selected camera operation to the
|
||||
and assigns the name of the currently selected CAM operation to the
|
||||
newly added operation. This is typically used in the context of managing
|
||||
camera operations in a 3D environment.
|
||||
CAM operations in a 3D environment.
|
||||
|
||||
Args:
|
||||
context: The context in which the operation is executed.
|
||||
|
@ -128,9 +128,9 @@ class CamChainOperationUp(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the operation to move the active camera operation in the chain.
|
||||
"""Execute the operation to move the active CAM operation in the chain.
|
||||
|
||||
This function retrieves the current scene and the active camera chain.
|
||||
This function retrieves the current scene and the active CAM chain.
|
||||
If there is an active operation (i.e., its index is greater than 0), it
|
||||
moves the operation one step up in the chain by adjusting the indices
|
||||
accordingly. After moving the operation, it updates the active operation
|
||||
|
@ -165,9 +165,9 @@ class CamChainOperationDown(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the operation to move the active camera operation in the chain.
|
||||
"""Execute the operation to move the active CAM operation in the chain.
|
||||
|
||||
This function retrieves the current scene and the active camera chain.
|
||||
This function retrieves the current scene and the active CAM chain.
|
||||
It checks if the active operation can be moved down in the list of
|
||||
operations. If so, it moves the active operation one position down and
|
||||
updates the active operation index accordingly.
|
||||
|
@ -201,10 +201,10 @@ class CamChainOperationRemove(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the operation to remove the active operation from the camera
|
||||
"""Execute the operation to remove the active operation from the CAM
|
||||
chain.
|
||||
|
||||
This method accesses the current scene and retrieves the active camera
|
||||
This method accesses the current scene and retrieves the active CAM
|
||||
chain. It then removes the currently active operation from that chain
|
||||
and adjusts the index of the active operation accordingly. If the active
|
||||
operation index becomes negative, it resets it to zero to ensure it
|
||||
|
|
|
@ -33,13 +33,13 @@ class CamOperationAdd(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation based on the active object in the scene.
|
||||
"""Execute the CAM 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
|
||||
performs operations related to CAM 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
|
||||
present, it adds a new CAM operation to the scene, sets its
|
||||
properties, and ensures that a machine area object is present.
|
||||
|
||||
Args:
|
||||
|
@ -87,10 +87,10 @@ class CamOperationCopy(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation in the given context.
|
||||
"""Execute the CAM 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
|
||||
This method handles the execution of CAM operations within the
|
||||
Blender scene. It first checks if there are any CAM 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.
|
||||
|
@ -121,11 +121,9 @@ class CamOperationCopy(Operator):
|
|||
o = scene.cam_operations[scene.cam_active_operation]
|
||||
|
||||
for k in copyop.keys():
|
||||
print("Key ", copyop[k])
|
||||
value = copyop[k]
|
||||
if isinstance(value, bpy.types.PropertyGroup):
|
||||
for subkey in value.keys():
|
||||
print("Subkey ", value[subkey])
|
||||
o[k][subkey] = value[subkey]
|
||||
else:
|
||||
o[k] = value
|
||||
|
@ -164,10 +162,10 @@ class CamOperationRemove(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation in the given context.
|
||||
"""Execute the CAM 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
|
||||
This function performs the active CAM operation by deleting the
|
||||
associated object from the scene. It checks if there are any CAM
|
||||
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
|
||||
|
@ -229,9 +227,9 @@ class CamOperationMove(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute a camera operation based on the specified direction.
|
||||
"""Execute a CAM operation based on the specified direction.
|
||||
|
||||
This method modifies the active camera operation in the Blender context
|
||||
This method modifies the active CAM 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
|
||||
|
|
|
@ -22,10 +22,10 @@ class CamOrientationAdd(Operator):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera orientation operation in Blender.
|
||||
"""Execute the CAM orientation operation in Blender.
|
||||
|
||||
This function retrieves the active camera operation from the current
|
||||
scene, creates an empty object to represent the camera orientation, and
|
||||
This function retrieves the active CAM operation from the current
|
||||
scene, creates an empty object to represent the CAM orientation, and
|
||||
adds it to a specified group. The empty object is named based on the
|
||||
operation's name and the current count of objects in the group. The size
|
||||
of the empty object is set to a predefined value for visibility.
|
||||
|
|
|
@ -56,12 +56,12 @@ class PathsBackground(Operator):
|
|||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation in the background.
|
||||
"""Execute the CAM operation in the background.
|
||||
|
||||
This method initiates a background process to perform camera operations
|
||||
based on the current scene and active camera operation. It sets up the
|
||||
This method initiates a background process to perform CAM operations
|
||||
based on the current scene and active CAM operation. It sets up the
|
||||
necessary paths for the script and starts a subprocess to handle the
|
||||
camera computations. Additionally, it manages threading to ensure that
|
||||
CAM computations. Additionally, it manages threading to ensure that
|
||||
the main thread remains responsive while the background operation is
|
||||
executed.
|
||||
|
||||
|
@ -112,10 +112,10 @@ class KillPathsBackground(Operator):
|
|||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation in the given context.
|
||||
"""Execute the CAM operation in the given context.
|
||||
|
||||
This method retrieves the active camera operation from the scene and
|
||||
checks if there are any ongoing processes related to camera path
|
||||
This method retrieves the active CAM operation from the scene and
|
||||
checks if there are any ongoing processes related to CAM path
|
||||
calculations. If such processes exist and match the current operation,
|
||||
they are terminated. The method then marks the operation as not
|
||||
computing and returns a status indicating that the execution has
|
||||
|
@ -147,7 +147,7 @@ class KillPathsBackground(Operator):
|
|||
async def _calc_path(operator, context):
|
||||
"""Calculate the path for a given operator and context.
|
||||
|
||||
This function processes the current scene's camera operations based on
|
||||
This function processes the current scene's CAM operations based on
|
||||
the specified operator and context. It handles different geometry
|
||||
sources, checks for valid operation parameters, and manages the
|
||||
visibility of objects and collections. The function also retrieves the
|
||||
|
@ -248,18 +248,18 @@ class CalculatePath(Operator, AsyncOperatorMixin):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
"""Check if the current camera operation is valid.
|
||||
"""Check if the current CAM operation is valid.
|
||||
|
||||
This method checks the active camera operation in the given context and
|
||||
This method checks the active CAM operation in the given context and
|
||||
determines if it is valid. It retrieves the active operation from the
|
||||
scene's camera operations and validates it using the `isValid` function.
|
||||
scene's CAM operations and validates it using the `isValid` function.
|
||||
If the operation is valid, it returns True; otherwise, it returns False.
|
||||
|
||||
Args:
|
||||
context (Context): The context containing the scene and camera operations.
|
||||
context (Context): The context containing the scene and CAM operations.
|
||||
|
||||
Returns:
|
||||
bool: True if the active camera operation is valid, False otherwise.
|
||||
bool: True if the active CAM operation is valid, False otherwise.
|
||||
"""
|
||||
|
||||
s = context.scene
|
||||
|
@ -297,13 +297,13 @@ class PathsAll(Operator):
|
|||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute camera operations in the current Blender context.
|
||||
"""Execute CAM operations in the current Blender context.
|
||||
|
||||
This function iterates through the camera operations defined in the
|
||||
This function iterates through the CAM operations defined in the
|
||||
current scene and executes the background calculation for each
|
||||
operation. It sets the active camera operation index and prints the name
|
||||
operation. It sets the active CAM operation index and prints the name
|
||||
of each operation being processed. This is typically used in a Blender
|
||||
add-on or script to automate camera path calculations.
|
||||
add-on or script to automate CAM path calculations.
|
||||
|
||||
Args:
|
||||
context (bpy.context): The current Blender context.
|
||||
|
@ -327,9 +327,9 @@ class PathsAll(Operator):
|
|||
"""Draws the user interface elements for the operation selection.
|
||||
|
||||
This method utilizes the Blender layout system to create a property
|
||||
search interface for selecting operations related to camera
|
||||
search interface for selecting operations related to CAM
|
||||
functionalities. It links the current instance's operation property to
|
||||
the available camera operations defined in the Blender scene.
|
||||
the available CAM operations defined in the Blender scene.
|
||||
|
||||
Args:
|
||||
context (bpy.context): The context in which the drawing occurs,
|
||||
|
@ -348,17 +348,17 @@ class PathsChain(Operator, AsyncOperatorMixin):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
"""Check the validity of the active camera chain in the given context.
|
||||
"""Check the validity of the active CAM chain in the given context.
|
||||
|
||||
This method retrieves the active camera chain from the scene and checks
|
||||
This method retrieves the active CAM chain from the scene and checks
|
||||
its validity using the `isChainValid` function. It returns a boolean
|
||||
value indicating whether the camera chain is valid or not.
|
||||
value indicating whether the CAM chain is valid or not.
|
||||
|
||||
Args:
|
||||
context (Context): The context containing the scene and camera chain information.
|
||||
context (Context): The context containing the scene and CAM chain information.
|
||||
|
||||
Returns:
|
||||
bool: True if the active camera chain is valid, False otherwise.
|
||||
bool: True if the active CAM chain is valid, False otherwise.
|
||||
"""
|
||||
|
||||
s = context.scene
|
||||
|
@ -369,10 +369,10 @@ class PathsChain(Operator, AsyncOperatorMixin):
|
|||
return False
|
||||
|
||||
async def execute_async(self, context):
|
||||
"""Execute asynchronous operations for camera path calculations.
|
||||
"""Execute asynchronous operations for CAM path calculations.
|
||||
|
||||
This method sets the object mode for the Blender scene and processes a
|
||||
series of camera operations defined in the active camera chain. It
|
||||
series of CAM operations defined in the active CAM chain. It
|
||||
reports the progress of each operation and handles any exceptions that
|
||||
may occur during the path calculation. After successful calculations, it
|
||||
exports the resulting mesh data to a specified G-code file.
|
||||
|
@ -426,18 +426,18 @@ class PathExportChain(Operator):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
"""Check the validity of the active camera chain in the given context.
|
||||
"""Check the validity of the active CAM chain in the given context.
|
||||
|
||||
This method retrieves the currently active camera chain from the scene
|
||||
This method retrieves the currently active CAM chain from the scene
|
||||
context and checks its validity using the `isChainValid` function. It
|
||||
returns a boolean indicating whether the active camera chain is valid or
|
||||
returns a boolean indicating whether the active CAM chain is valid or
|
||||
not.
|
||||
|
||||
Args:
|
||||
context (object): The context containing the scene and camera chain information.
|
||||
context (object): The context containing the scene and CAM chain information.
|
||||
|
||||
Returns:
|
||||
bool: True if the active camera chain is valid, False otherwise.
|
||||
bool: True if the active CAM chain is valid, False otherwise.
|
||||
"""
|
||||
|
||||
s = context.scene
|
||||
|
@ -445,9 +445,9 @@ class PathExportChain(Operator):
|
|||
return chain_valid(chain, context)[0]
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera path export process.
|
||||
"""Execute the CAM path export process.
|
||||
|
||||
This function retrieves the active camera chain from the current scene
|
||||
This function retrieves the active CAM chain from the current scene
|
||||
and gathers the mesh data associated with the operations of that chain.
|
||||
It then exports the G-code path using the specified filename and the
|
||||
collected mesh data. The function is designed to be called within the
|
||||
|
@ -484,12 +484,12 @@ class PathExport(Operator):
|
|||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
"""Execute the camera operation and export the G-code path.
|
||||
"""Execute the CAM operation and export the G-code path.
|
||||
|
||||
This method retrieves the active camera operation from the current scene
|
||||
This method retrieves the active CAM operation from the current scene
|
||||
and exports the corresponding G-code path to a specified filename. It
|
||||
prints the filename and relevant operation details to the console for
|
||||
debugging purposes. The G-code path is generated based on the camera
|
||||
debugging purposes. The G-code path is generated based on the CAM
|
||||
path data associated with the active operation.
|
||||
|
||||
Args:
|
||||
|
|
|
@ -42,10 +42,10 @@ class CAMSimulate(Operator, AsyncOperatorMixin):
|
|||
)
|
||||
|
||||
async def execute_async(self, context):
|
||||
"""Execute an asynchronous simulation operation based on the active camera
|
||||
"""Execute an asynchronous simulation operation based on the active CAM
|
||||
operation.
|
||||
|
||||
This method retrieves the current scene and the active camera operation.
|
||||
This method retrieves the current scene and the active CAM operation.
|
||||
It constructs the operation name and checks if the corresponding object
|
||||
exists in the Blender data. If it does, it attempts to run the
|
||||
simulation asynchronously. If the simulation is cancelled, it returns a
|
||||
|
@ -76,10 +76,10 @@ class CAMSimulate(Operator, AsyncOperatorMixin):
|
|||
return {"FINISHED"}
|
||||
|
||||
def draw(self, context):
|
||||
"""Draws the user interface for selecting camera operations.
|
||||
"""Draws the user interface for selecting CAM operations.
|
||||
|
||||
This method creates a layout element in the user interface that allows
|
||||
users to search and select a specific camera operation from a list of
|
||||
users to search and select a specific CAM operation from a list of
|
||||
available operations defined in the current scene. It utilizes the
|
||||
Blender Python API to integrate with the UI.
|
||||
|
||||
|
@ -102,18 +102,18 @@ class CAMSimulateChain(Operator, AsyncOperatorMixin):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
"""Check the validity of the active camera chain in the scene.
|
||||
"""Check the validity of the active CAM chain in the scene.
|
||||
|
||||
This method retrieves the currently active camera chain from the scene's
|
||||
camera chains and checks its validity using the `isChainValid` function.
|
||||
It returns a boolean indicating whether the active camera chain is
|
||||
This method retrieves the currently active CAM chain from the scene's
|
||||
CAM chains and checks its validity using the `isChainValid` function.
|
||||
It returns a boolean indicating whether the active CAM chain is
|
||||
valid.
|
||||
|
||||
Args:
|
||||
context (object): The context containing the scene and its properties.
|
||||
|
||||
Returns:
|
||||
bool: True if the active camera chain is valid, False otherwise.
|
||||
bool: True if the active CAM chain is valid, False otherwise.
|
||||
"""
|
||||
|
||||
s = context.scene
|
||||
|
@ -130,9 +130,9 @@ class CAMSimulateChain(Operator, AsyncOperatorMixin):
|
|||
)
|
||||
|
||||
async def execute_async(self, context):
|
||||
"""Execute an asynchronous simulation for a specified camera chain.
|
||||
"""Execute an asynchronous simulation for a specified CAM chain.
|
||||
|
||||
This method retrieves the active camera chain from the current Blender
|
||||
This method retrieves the active CAM chain from the current Blender
|
||||
scene and determines the operations associated with that chain. It
|
||||
checks if all operations are valid and can be simulated. If valid, it
|
||||
proceeds to execute the simulation asynchronously. If any operation is
|
||||
|
@ -167,10 +167,10 @@ class CAMSimulateChain(Operator, AsyncOperatorMixin):
|
|||
return {"FINISHED"}
|
||||
|
||||
def draw(self, context):
|
||||
"""Draw the user interface for selecting camera operations.
|
||||
"""Draw the user interface for selecting CAM operations.
|
||||
|
||||
This function creates a user interface element that allows the user to
|
||||
search and select a specific camera operation from a list of available
|
||||
search and select a specific CAM operation from a list of available
|
||||
operations in the current scene. It utilizes the Blender Python API to
|
||||
create a property search layout.
|
||||
|
||||
|
|
|
@ -111,15 +111,15 @@ def deleteFirstVert(ob):
|
|||
|
||||
|
||||
def testCalc(o):
|
||||
"""Test the calculation of the camera path for a given object.
|
||||
"""Test the calculation of the CAM path for a given object.
|
||||
|
||||
This function invokes the Blender operator to calculate the camera path
|
||||
This function invokes the Blender operator to calculate the CAM path
|
||||
for the specified object and then deletes the first vertex of that
|
||||
object. It is intended to be used within a Blender environment where the
|
||||
bpy module is available.
|
||||
|
||||
Args:
|
||||
o (Object): The Blender object for which the camera path is to be calculated.
|
||||
o (Object): The Blender object for which the CAM path is to be calculated.
|
||||
"""
|
||||
bpy.ops.object.calculate_cam_path()
|
||||
deleteFirstVert(bpy.data.objects[o.name])
|
||||
|
@ -129,8 +129,8 @@ def testCutout(pos):
|
|||
"""Test the cutout functionality in the scene.
|
||||
|
||||
This function adds a test curve based on the provided position, performs
|
||||
a camera operation, and sets the strategy to 'CUTOUT'. It then calls the
|
||||
`testCalc` function to perform further calculations on the camera
|
||||
a CAM operation, and sets the strategy to 'CUTOUT'. It then calls the
|
||||
`testCalc` function to perform further calculations on the CAM
|
||||
operation.
|
||||
|
||||
Args:
|
||||
|
@ -148,7 +148,7 @@ def testPocket(pos):
|
|||
"""Test the pocket operation in a 3D scene.
|
||||
|
||||
This function sets up a pocket operation by adding a test curve based on
|
||||
the provided position. It configures the camera operation settings for
|
||||
the provided position. It configures the CAM operation settings for
|
||||
the pocket strategy, enabling helix entry and tangential retraction.
|
||||
Finally, it performs a calculation based on the configured operation.
|
||||
|
||||
|
@ -166,12 +166,12 @@ def testPocket(pos):
|
|||
|
||||
|
||||
def testParallel(pos):
|
||||
"""Test the parallel functionality of the camera operations.
|
||||
"""Test the parallel functionality of the CAM operations.
|
||||
|
||||
This function adds a test mesh at a specified position and then performs
|
||||
camera operations in the Blender environment. It sets the ambient
|
||||
behavior of the camera operation to 'AROUND' and configures the material
|
||||
radius around the model. Finally, it calculates the camera path based on
|
||||
CAM operations in the Blender environment. It sets the ambient
|
||||
behavior of the CAM operation to 'AROUND' and configures the material
|
||||
radius around the model. Finally, it calculates the CAM path based on
|
||||
the current scene settings.
|
||||
|
||||
Args:
|
||||
|
@ -190,7 +190,7 @@ def testWaterline(pos):
|
|||
"""Test the waterline functionality in the scene.
|
||||
|
||||
This function adds a test mesh at a specified position and then performs
|
||||
a camera operation with the strategy set to 'WATERLINE'. It also
|
||||
a CAM operation with the strategy set to 'WATERLINE'. It also
|
||||
configures the optimization pixel size for the operation. The function
|
||||
is intended for use in a 3D environment where waterline calculations are
|
||||
necessary for rendering or simulation.
|
||||
|
@ -219,11 +219,11 @@ def testSimulation():
|
|||
|
||||
|
||||
def cleanUp():
|
||||
"""Clean up the Blender scene by removing all objects and camera
|
||||
"""Clean up the Blender scene by removing all objects and CAM
|
||||
operations.
|
||||
|
||||
This function selects all objects in the current Blender scene and
|
||||
deletes them. It also removes any camera operations that are present in
|
||||
deletes them. It also removes any CAM operations that are present in
|
||||
the scene. This is useful for resetting the scene to a clean state
|
||||
before performing further operations.
|
||||
"""
|
||||
|
@ -234,18 +234,18 @@ def cleanUp():
|
|||
|
||||
|
||||
def testOperation(i):
|
||||
"""Test the operation of a camera path in Blender.
|
||||
"""Test the operation of a CAM path in Blender.
|
||||
|
||||
This function tests a specific camera operation by comparing the
|
||||
generated camera path with an existing reference path. It retrieves the
|
||||
camera operation from the scene and checks if the generated path matches
|
||||
This function tests a specific CAM operation by comparing the
|
||||
generated CAM path with an existing reference path. It retrieves the
|
||||
CAM operation from the scene and checks if the generated path matches
|
||||
the expected path in terms of vertex count and positions. If there is no
|
||||
existing reference path, it marks the new result as comparable. The
|
||||
function generates a report detailing the results of the comparison,
|
||||
including any discrepancies found.
|
||||
|
||||
Args:
|
||||
i (int): The index of the camera operation to test.
|
||||
i (int): The index of the CAM operation to test.
|
||||
|
||||
Returns:
|
||||
str: A report summarizing the results of the operation test.
|
||||
|
@ -289,13 +289,13 @@ def testOperation(i):
|
|||
|
||||
|
||||
def testAll():
|
||||
"""Run tests on all camera operations in the current scene.
|
||||
"""Run tests on all CAM operations in the current scene.
|
||||
|
||||
This function iterates through all camera operations defined in the
|
||||
This function iterates through all CAM operations defined in the
|
||||
current Blender scene and executes a test for each operation. The
|
||||
results of these tests are collected into a report string, which is then
|
||||
printed to the console. This is useful for verifying the functionality
|
||||
of camera operations within the Blender environment.
|
||||
of CAM operations within the Blender environment.
|
||||
"""
|
||||
s = bpy.context.scene
|
||||
report = ""
|
||||
|
|
|
@ -104,10 +104,10 @@ def on_blender_startup(context):
|
|||
|
||||
This function verifies the presence of necessary Blender add-ons and
|
||||
installs any that are missing. It also resets any ongoing computations
|
||||
in camera operations and sets the interface level to the previously used
|
||||
in CAM operations and sets the interface level to the previously used
|
||||
level when loading a new file. If the add-on has been updated, it copies
|
||||
the necessary presets from the source to the target directory.
|
||||
Additionally, it checks for updates to the camera plugin and updates
|
||||
Additionally, it checks for updates to the CAM plugin and updates
|
||||
operation presets if required.
|
||||
|
||||
Args:
|
||||
|
|
|
@ -45,12 +45,12 @@ def add_material_area_object():
|
|||
already exists in the current scene. If it does, it retrieves that
|
||||
object; if not, it creates a new cube mesh object to serve as the
|
||||
material area. The dimensions and location of the object are set based
|
||||
on the current camera operation's bounds. The function also applies
|
||||
on the current CAM operation's bounds. The function also applies
|
||||
transformations to ensure the object's location and dimensions are
|
||||
correctly set. The created or retrieved object is configured to be non-
|
||||
renderable and non-selectable in the viewport, while still being
|
||||
selectable for operations. This is useful for visualizing the working
|
||||
area of the camera without affecting the render output. Raises:
|
||||
area of the CAM without affecting the render output. Raises:
|
||||
None
|
||||
"""
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ def get_operation_sources(o):
|
|||
|
||||
|
||||
def reload_paths(o):
|
||||
"""Reload the camera path data from a pickle file.
|
||||
"""Reload the CAM path data from a pickle file.
|
||||
|
||||
This function retrieves the camera path data associated with the given
|
||||
This function retrieves the CAM path data associated with the given
|
||||
object `o`. It constructs a new mesh from the path vertices and updates
|
||||
the object's properties with the loaded data. If a previous path mesh
|
||||
exists, it is removed to avoid memory leaks. The function also handles
|
||||
|
@ -90,7 +90,7 @@ def reload_paths(o):
|
|||
current scene.
|
||||
|
||||
Args:
|
||||
o (Object): The object for which the camera path is being
|
||||
o (Object): The object for which the CAM path is being
|
||||
"""
|
||||
|
||||
oname = "cam_path_" + o.name
|
||||
|
@ -136,10 +136,10 @@ def reload_paths(o):
|
|||
|
||||
|
||||
def update_operation(self, context):
|
||||
"""Update the visibility and selection state of camera operations in the
|
||||
"""Update the visibility and selection state of CAM operations in the
|
||||
scene.
|
||||
|
||||
This method manages the visibility of objects associated with camera
|
||||
This method manages the visibility of objects associated with CAM
|
||||
operations based on the current active operation. If the
|
||||
'hide_all_others' flag is set to true, it hides all other objects except
|
||||
for the currently active one. If the flag is false, it restores the
|
||||
|
@ -228,15 +228,15 @@ def source_valid(o, context):
|
|||
|
||||
|
||||
def operation_valid(self, context):
|
||||
"""Validate the current camera operation in the given context.
|
||||
"""Validate the current CAM operation in the given context.
|
||||
|
||||
This method checks if the active camera operation is valid based on the
|
||||
This method checks if the active CAM operation is valid based on the
|
||||
current scene context. It updates the operation's validity status and
|
||||
provides warnings if the source object is invalid. Additionally, it
|
||||
configures specific settings related to image geometry sources.
|
||||
|
||||
Args:
|
||||
context (Context): The context containing the scene and camera operations.
|
||||
context (Context): The context containing the scene and CAM operations.
|
||||
"""
|
||||
|
||||
scene = context.scene
|
||||
|
@ -265,14 +265,14 @@ def chain_valid(chain, context):
|
|||
This function verifies if all operations in the provided chain are valid
|
||||
according to the current scene context. It first checks if the chain
|
||||
contains any operations. If it does, it iterates through each operation
|
||||
in the chain and checks if it exists in the scene's camera operations.
|
||||
in the chain and checks if it exists in the scene's CAM operations.
|
||||
If an operation is not found or is deemed invalid, the function returns
|
||||
a tuple indicating the failure and provides an appropriate error
|
||||
message. If all operations are valid, it returns a success indication.
|
||||
|
||||
Args:
|
||||
chain (Chain): The chain of operations to validate.
|
||||
context (Context): The context containing the scene and camera operations.
|
||||
context (Context): The context containing the scene and CAM operations.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a boolean indicating validity and an error message
|
||||
|
@ -455,11 +455,11 @@ def update_rest(o, context):
|
|||
|
||||
|
||||
def update_operation(self, context):
|
||||
"""Update the camera operation based on the current context.
|
||||
"""Update the CAM operation based on the current context.
|
||||
|
||||
This function retrieves the active camera operation from the Blender
|
||||
This function retrieves the active CAM operation from the Blender
|
||||
context and updates it using the `updateRest` function. It accesses the
|
||||
active operation from the scene's camera operations and passes the
|
||||
active operation from the scene's CAM operations and passes the
|
||||
current context to the updating function.
|
||||
|
||||
Args:
|
||||
|
@ -472,11 +472,11 @@ def update_operation(self, context):
|
|||
|
||||
|
||||
def update_zbuffer_image(self, context):
|
||||
"""Update the Z-buffer image based on the active camera operation.
|
||||
"""Update the Z-buffer image based on the active CAM operation.
|
||||
|
||||
This function retrieves the currently active camera operation from the
|
||||
This function retrieves the currently active CAM operation from the
|
||||
Blender context and updates the Z-buffer image accordingly. It accesses
|
||||
the scene's camera operations and invokes the `updateZbufferImage`
|
||||
the scene's CAM operations and invokes the `updateZbufferImage`
|
||||
function with the active operation and context.
|
||||
|
||||
Args:
|
||||
|
@ -493,7 +493,7 @@ def get_chain_operations(chain):
|
|||
|
||||
This function iterates through the operations of the provided chain
|
||||
object and retrieves the corresponding operations from the current
|
||||
scene's camera operations in Blender. Due to limitations in Blender,
|
||||
scene's CAM operations in Blender. Due to limitations in Blender,
|
||||
chain objects cannot store operations directly, so this function serves
|
||||
to extract and return the relevant operations for further processing.
|
||||
|
||||
|
|
|
@ -213,9 +213,9 @@ def get_strategy_list(scene, context):
|
|||
|
||||
|
||||
def update_exact_mode(self, context):
|
||||
"""Update the exact mode of the active camera operation.
|
||||
"""Update the exact mode of the active CAM operation.
|
||||
|
||||
This function retrieves the currently active camera operation from the
|
||||
This function retrieves the currently active CAM operation from the
|
||||
Blender context and updates its exact mode using the `updateExact`
|
||||
function. It accesses the active operation through the `cam_operations`
|
||||
list in the current scene and passes the active operation along with the
|
||||
|
@ -233,9 +233,9 @@ def update_exact_mode(self, context):
|
|||
def update_opencamlib(self, context):
|
||||
"""Update the OpenCamLib with the current active operation.
|
||||
|
||||
This function retrieves the currently active camera operation from the
|
||||
This function retrieves the currently active CAM operation from the
|
||||
Blender context and updates the OpenCamLib accordingly. It accesses the
|
||||
active operation from the scene's camera operations and passes it along
|
||||
active operation from the scene's CAM operations and passes it along
|
||||
with the current context to the update function.
|
||||
|
||||
Args:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
They mostly call the functions from 'utils.py'
|
||||
"""
|
||||
|
||||
import threading
|
||||
|
||||
import bpy
|
||||
|
@ -46,12 +47,12 @@ def thread_read(tcom):
|
|||
|
||||
@bpy.app.handlers.persistent
|
||||
def timer_update(context):
|
||||
"""Monitor background processes related to camera path calculations.
|
||||
"""Monitor background processes related to CAM path calculations.
|
||||
|
||||
This function checks the status of background processes that are
|
||||
responsible for calculating camera paths. It retrieves the current
|
||||
responsible for calculating CAM paths. It retrieves the current
|
||||
processes and monitors their state. If a process has finished, it
|
||||
updates the corresponding camera operation and reloads the necessary
|
||||
updates the corresponding CAM operation and reloads the necessary
|
||||
paths. If the process is still running, it restarts the associated
|
||||
thread to continue monitoring.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue