Open Mysteryem opened 2 years ago
Dropping 2.79 also means we could change some code that requires Edit mode and iterates through a list of meshes, to open all of the required meshes into Edit mode simultaneously instead of opening each mesh individually, due to 2.80's new feature of multi-editing.
Organisation
common
, split it up further into submodules with the functions grouped by what they do or what types of objects they act on. (similarly split up the 'utils' module if that ends up huge)PropertyGroup
s. The more properties we add directly the the Scene and other types, the more we run the risk of being incompatible with other addons due to a naming conflict. Generic sounding properties like 'armature' and 'head' are particularly concerning. The alternative would be to prefix all Cats properties with 'cats_' or similar, but I've got enough clutter in my bpy.types.Scene from other addons that aren't using a PropertyGroup already that I would much rather put them into a PropertyGroup.Formatting
_
.Coding conventions and optimisation
except
clauses. There should always be at least one exception in theexcept
clause so that it is clear what exceptions are expected that they might happen and so that unexpected exceptions are not mistakenly handled incorrectly. If it's easy to check if the exception will occur before running the code in thetry
block then do so instead of relying on anexcept
clause.bpy.context
in functions that already have access to the current context. This will also allow those functions to use context overrides.self
parameter (and aren't overriding a method from a superclass), remove it and add@staticmethod
to the function.Personally, I would also like to drop support for 2.79 (or even all versions older than the current oldest LTS release of 2.83). 2.79 had its final update just over 4 years ago and 2.80 had a lot of breaking changes so there's a lot of code in Cats for specifically handling 2.79 that could be removed. Moving to 2.80+ also moves the minimum Python version to 3.6, giving us access to variable annotations (so we can remove the annotations part of
@register_wrap
and define properties using annotations), formatted string literals (print(f"Found {mesh.name}")
) and dictionaries that preserve insertion order by default (yes, it's only an implementation detail in CPython 3.6, but we know that it was made the standard Python 3.7).As far as I can tell, the only reason we have google_trans_new copied directly into Cats instead of as a submodule, is so that we can disable all the code that uses
urllib3
due to it not being included with 2.79's bundled Python.Additionally, if we were to drop support for 2.79, would we be able to stop including mmd_tools directly and instead include it as a submodule too? The new 2.3.0 version of mmd_tools itself, that is now in the development branch as mmd_tools_local, dropped support for 2.79 so I can see that we've had to modify it for 2.79 support.