Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import fix #144

Merged
merged 15 commits into from
Mar 25, 2024
Merged

Import fix #144

merged 15 commits into from
Mar 25, 2024

Conversation

SpectralVectors
Copy link
Collaborator

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

Two Notes:

  • I had a small issue with my auto formatter between the last commit and this one, and I accidentally changed the line length from 100 characters to 79, this resulted in some lines unrelated to imports showing up in the diff
  • I'm not totally sure why I 'Can't automatically merge' this commit with your branch, but I can with the main branch. I updated the version number in the version.py file this time, but that didn't do the trick.

If there is an issue or a mistake, let me know and I will update/fix it.
As before I created a 1.0.7a release for easy download and testing.

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 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
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.
@SpectralVectors
Copy link
Collaborator Author

Found a bug, will reopen when I've fixed it.

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.
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.
@SpectralVectors
Copy link
Collaborator Author

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 (I accidentally changed line length from 100 to 79 between commits), and restore all the code to its previous state. This should significantly clean up the diff.
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.

As before the test release 1.0.7a has been updated to reflect the latest changes.

Caught a handful more lines that needed to be reverted to clean up the diff.
Caught a handful more lines that needed to be reverted to clean up the diff.
Caught a handful more lines that needed to be reverted to clean up the diff.
Caught a handful more lines that needed to be reverted to clean up the diff.
@SpectralVectors
Copy link
Collaborator Author

SpectralVectors commented Mar 23, 2024

Last commit was to address a handful of lines that I missed during the initial autoformat fix.

I ran the test suite this time, and it seems to have generated a number of .exr files, are these intended to be uploaded, or should I delete them?

@pppalain pppalain merged commit 810cf76 into pppalain:master Mar 25, 2024
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants