Operation Presets have been updated to create a new operation by default, they will also now follow the naming convention - OP_ObjectName_OperationNumber_PresetName, to keep in line with the naming of default operations.
I submitted the last commit after checking my `cam_chunk` file against the `chunk` file in Alain's repo to make sure I hadn't introduced any errors.
When I saw that his code had `nchunk_points` I assumed that my change was a mistake, and I reverted it.
However, upon closer inspection of the code, I believe that it should, in fact, be changed.
There is no reference to `nchunk_points` elsewhere in the code, though there is a similarly named `chunk_points` variable.
`nchunk` is an instance of `camPathChunkBuilder` which has `points`, but not `nchunk_points`.
Cutter and Machine Presets worked without issue.
Operation presets would load, but could not be saved - `AttributeError`
This was caused by 3 errors in `AddPresetCamOperation` in `init`:
- `o.movement.movement.spindle_rotation` changed to `o.movement.spindle_rotation`
- `o.optimize` and `o.optimize_threshold` changed to `o.optimisation.optimize` and `o.optimisation.optimize_threshold`
Discovered this while trying to add a small usability patch that would add an operation if there wasn't already on in the scene, so that loading an operation preset wouldn't cause an error message.
Patch was done by adding a `setup_operation_preset` function in `utils` that would `try: except` to try to adjust an existing operation, but add one if one isn't present.
I also patched the existing operation presets, though they aren't copied to disk by default, so I added a `BoolProperty` to the `AddonPreferences` and copy logic to the `check_operations_on_load` handler so that they will only be copied once. The copy operation does not affect any additional presets the user may have, only the default set that come with the addon.
Also fixed the 'Material Preview' viewport mode.
Previously the object would disappear when switching to that mode.
Render Engines have the option to 'borrow' Material Preview mode from EEVEE via a boolean `bl_use_eevee_viewport = True`
I set that, and added the panels to the Material tab when in Cam.
Commented out `numba` import from the `__init__` for now, until the issues with crashing can be resolved.
Moved `_IS_LOADING_DEFAULTS` out of the `updateMachine` function, declared the default value = False, and grabbed it via `utils.IS_LOADING_DEFAULTS`.
(Note: It was already declared a `global` variable within the function, and I thought that would have been enough to avoid this error, but it works now)
Lastly, altered the cleanup in the `_calc_path` function in `ops.py` - previously it was checking for and deleting objects without issues.
In Blender 4.1 deleting an object would still leave behind mesh data that retained the object name, causing the cleanup function to not recognize and update old operations.
Simply deleting the mesh data solves the issue, as it will also delete the object with it, even though the reverse is no longer true.
While rearranging and cleaning up the utils imports in the initial 'Import fix' commit I deleted `utils.` from `bpy.utils.script_paths()` in the ops.py file.
This has been fixed, and I took the opportunity to reverse the autoformat issue (changed line length from 100 to 89 between commits), and restore all the code to its previous state.
I made one exception:
- comments that came at the end of the line that were moved to the line above
All functional code has been restored to its previous format.
While rearranging and cleaning up the utils imports in the initial 'Import fix' commit I deleted `utils.` from `bpy.utils.script_paths()` in the ops.py file.
This has been fixed, and I took the opportunity to reverse the autoformat issue (changed line length from 100 to 89 between commits), and restore all the code to its previous state.
I made one exception:
- comments that came at the end of the line that were moved to the line above
All functional code has been restored to its previous format.
While rearranging and cleaning up the utils imports in the initial 'Import fix' commit I deleted `utils.` from `bpy.utils.script_paths()` in the ops.py file.
This has been fixed, and I took the opportunity to reverse the autoformat issue (changed line length from 100 to 89 between commits), and restore all the code to its previous state.
I made one exception:
- comments that came at the end of the line that were moved to the line above
All functional code has been restored to its previous format.
version was previously only updated in bl_info, it has now been updated to match in the version.py file as well, which should allow it to display in the main UI.
Changed all imports from absolute to relative:
- instead of importing the module 'cam' now imports come from '.' the relative parent folder
- importing the module into itself resulted in a circular import error, relative imports avoid this
Moved Functions, refs updated:
- some functions (and 2 variables) only existed on the base level of the module, in the init file, and could not otherwise be accessed, they were moved into the utils file with other similar functions
- these were primarily called as update functions for Properties scattered across the addon, these have all been updated to reflect the new location and import convention
opencamlib_version rename:
- in 2 files there was a local variable named 'opencamlib_version' that was defined by a function called 'opencamlib_version' that returned the opencamlib_version
- this seemed to confuse Blender into thinking that it was being called before it was defined, and simply changing the variable name to 'ocl_version' while keeping the function name as 'opencamlib_version' fixed the issue
Changed all imports from absolute to relative:
- instead of importing the module 'cam' now imports come from '.' the relative parent folder
- importing the module into itself resulted in a circular import error, relative imports avoid this
Moved Functions, refs updated:
- some functions (and 2 variables) only existed on the base level of the module, in the init file, and could not otherwise be accessed, they were moved into the utils file with other similar functions
- these were primarily called as update functions for Properties scattered across the addon, these have all been updated to reflect the new location and import convention
opencamlib_version rename:
- in 2 files there was a local variable named 'opencamlib_version' that was defined by a function called 'opencamlib_version' that returned the opencamlib_version
- this seemed to confuse Blender into thinking that it was being called before it was defined, and simply changing the variable name to 'ocl_version' while keeping the function name as 'opencamlib_version' fixed the issue
Changed the formatting of Properties (e.g. bpy.props.StringProperty) throughout:
Before:
```
use_position_definitions: bpy.props.BoolProperty(name="Use position definitions",
description="Define own positions for op start, "
"toolchange, ending position",
default=False)
```
After:
```
use_position_definitions: BoolProperty(
name="Use position definitions",
description="Define own positions for op start, "
"toolchange, ending position",
default=False,
)
```
Added trailing commas to retain formatting if another autoformatter (e.g.: black) is implemented.
Removed bpy.props. prefix from Properties that still had it, and added explicit imports when required in ui_panels module.
Ran Autopep8 on all files in repo, they are otherwise untouched with one exception:
In the __init__ file, I had to manually rearrange the import statements to avoid triggering a circular import error.
This will be addressed in a future commit.
Updated authors in bl_info to: 'Vilem Novak & Contributors' - this can be changed as required
Updated version to: 1.0.5
Ran Autopep8 on all files in repo, they are otherwise untouched with one exception:
In the __init__ file, I had to manually rearrange the import statements to avoid triggering a circular import error.
This will be addressed in a future commit.
Updated authors in bl_info to: 'Vilem Novak & Contributors' - this can be changed as required
Updated version to: 1.0.5
Ran Autopep8 on all files in repo, they are otherwise untouched with one exception:
In the __init__ file, I had to manually rearrange the import statements to avoid triggering a circular import error.
This will be addressed in a future commit.
Updated authors in bl_info to: 'Vilem Novak & Contributors' - this can be changed as required
Updated version to: 1.0.5