-
Notifications
You must be signed in to change notification settings - Fork 140
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
ENH: Long-overdue update to Blender 2.8+ #406
Conversation
Minor comments:
|
… the file was indeed created with blender 2.7, and confirmed by the user.
Thanks for feedback!
Minor: |
Great!
|
|
Could we just deprecate blender 2.7 and avoid having to track blender versions? EDIT: my reasoning for this is: what will happen when Blender 2.9, 3.0 comes out? Will we have to change this logic once more? This doesn't sound very sustainable. |
5.6.7. Fair enough. Given the fact that Blender does not warn for their backward incompatibility, I think there is no need to have a bulletproof solution in pycortex. |
Current version checks work for 2.9 just fine, will work for all after. The version string checks return a tuple in the form of (major_version, minor_version), and it is checked with an inequality. Through dealing with this issue, I learned that you can do e.g. (1, 2) < (1, 4) and it works. Anyway, checks are for versions greater than or equal to, or less than, (2, 80). So code should be fine as it is for the foreseeable future (as much as anything is...) |
cortex/blender/blendlib.py
Outdated
bpy.ops.object.select_all(action='SELECT') | ||
bpy.ops.object.delete() | ||
|
||
def init_subject(wpts, ipts, polys, curv): | ||
"""Initialize a suject """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suject
-> subject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're at it, sure.
LGTM. Tests would be nice. But this is more of a helper function than a core pycortex function, so I guess we can be a bit relaxed about it...(last famous words?) |
Tests never have existed for the surface-cutting functionality, as far as I know. We can add it as another issue on git to be addressed separately. It's complicated to test, in what would seem to be the correct way, because cutting a surface relies on blender (potentially multiple versions thereof), freesurfer, and an extant freesurfer subjects directory and data in there. There are also manual steps in this process, and catching all errors that might result from those is... pretty much impossible. So yes, I don't think there's a solution besides being a bit lax on best practices for this specific issue. |
approximately working, needs further testing.
One big annoyance with blender 2.8 is that if you open a .blend file with blender 2.8+, you will no longer be able to open it with blender 2.7. Nuking backward compatibility seems bad, so what I have tried to do here is implement an automatic (and likely annoying) backup: every time you try to call a command that opens blender on an extant file, it creates a backup (_b2.7bkup.blend). This happens once for the file (presumably, the first time it is called with the updated code if the blender version is >= 2.8).
Putting a flag around these backups is potentially a good idea - something settable in the config file? e.g. make_legacy_backups=True, then once people decide they don't want a million _b2.7bkup files running around, and that they are committed to more recent blender, they can shut it off and delete those files?
This element is still a bit kludge-y, but it's aiming to prevent pain and suffering. Happy to take suggestions on how to better handle this. The compatibility with blender 2.8+ wasn't actually bad at all, just a few lines.