Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Preparing the great migration 🐧 #1

@Lauloque

Description

@Lauloque

Image

Suggested by Dr Sybren, in preparation to merging my addon into unlooped

A few things, all of them are quite easy to handle:

  • In my new code I never use os.path, and use pathlib.Path instead.
  • Type annotations
  • get_playback_modes() doesn't retain a reference to the returned list, which can cause memory corruption (see the warning in Property Definitions (bpy.props) - Blender Python API)
  • loop_methods_playback_handler() doesn't deal with the scene preview range yet. My add-on also doesn't do this -- this is why code review is so good, it makes you realize things you overlooked while writing the code 😹
  • The code should follow PEP8, so for example bpy.types.Scene.Loop_Methods_Settings should be named bpy.types.Scene.loop_methods_settings
  • Instead of manually calling bpy.utils.register_class for each class, I'd use bpy.utils.register_classes_factory() instead.
  • Since your our :) add-on targets Blender 4.3+, you can remove the bl_info; that's only necessary when targeting Blender versions before 4.2. Or we can test with older versions of Blender and still support 3.6-LTS.
  • Instead of from bpy.utils import previews I would import bpy.utils, and then use bpy.utils.previews.… in the code. That way it's easier to locally see in the code that this is calling into Blender code. Otherwise I'd feel that previews is such a generic term that it could come from anything.
  • The global icon_collections statement can be removed, as the way it's used in that function doesn't need it. Having said that, I'd probably not even use a dictionary there, name it the singular icon_collection, keep the global statement, and just directly use  icon_collection = pcoll. The way your code is structured, there is no need to use a dictionary here.
  • draw_playback_mode_dropdown accesses bpy.context, even though it gets a context from the caller. It should just use that context, and not the global one.
  • My add-on draws the icon in all Dopesheet headers, which includes the timeline. I think that's a better approach than limiting it to the Dopesheet mode of the Dopesheet editor, as it might just as well be useful in the Action editor (and all its other modes), or the Timeline editor.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions