Skip to content

Feat: Blender 4.0/5.0 API Compatibility Fixes#397

Open
GeorgeKugler wants to merge 1 commit intodfki-ric:masterfrom
GeorgeKugler:blender-5.0-fixes
Open

Feat: Blender 4.0/5.0 API Compatibility Fixes#397
GeorgeKugler wants to merge 1 commit intodfki-ric:masterfrom
GeorgeKugler:blender-5.0-fixes

Conversation

@GeorgeKugler
Copy link

This pull request resolves a series of critical API compatibility issues that prevented Phobos from running correctly on Blender 4.0, 5.0, and newer versions. The addon would fail to register, and several core features would cause crashes or errors due to deprecated APIs.

Summary of Changes

This PR introduces a chain of fixes to stabilize the addon for modern Blender versions:

  • bgl/blf API Migration:

    • Replaced deprecated bgl and blf module usage with the modern gpu shader-based API for viewport drawing in operators/poses.py. This resolves a ModuleNotFoundError on startup.
  • bpy.props API Updates:

    • AddonPreferences: Refactored the loglevel property in phobosgui.py to use a dedicated storage property, fixing a TypeError related to accessing IDProperties on bpy_struct.
    • Bone Selection: Replaced the deprecated bone.select property with the correct API call in model/joints.py, fixing an AttributeError when defining joints.
  • Operator & Workflow Fixes:

    • Crash Prevention: Added poll() methods to operators (StorePoseOperator) to prevent them from running in an invalid context, which was causing segmentation faults.
    • UI Stability: Replaced an unstable ErrorMessageWithBox call with the standard self.report() in DefineJointConstraintsOperator to prevent crashes.
    • Operator Invocation: Added or fixed invoke() methods for several operators to ensure their UI dialogs are invoked correctly.
    • CreateLinksOperator: Made the operator more robust and intuitive by correctly handling multiple objects, context-aware defaults, applied transforms, and collection placement.
  • Testing:

    • Added new unit and smoke test files to verify several of the above fixes.

These changes collectively bring Phobos back to a stable, usable state on modern Blender versions.

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.

1 participant