Skip to content

Blender 5.0 breaks the generate function in MCprep #668

Description

@StandingPadAnimations

Did the issue happen after restarting Blender?

  • Yes, the issue indeed continued after restarting Blender

Check known issues

  • I have checked known issues, and my problem is different

What happened?

In Blender 5.0, when spawning rigs or blocks, or prepping materials, the following errors are thrown

  • Block spawning:
File "/home/mahid/.config/blender/5.0/scripts/addons/MCprep_addon/materials/generate.py", line 1221, in generate_base_material
    node_diff["MCPREP_diffuse"] = True
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^
TypeError: bpy_struct[key] = val: id properties not supported for this type
  • Rig spawning (though the spawner seems to be able to gracefully handle this):
File "/home/mahid/.config/blender/5.0/scripts/addons/MCprep_addon/materials/generate.py", line 564, in get_textures
    elif "MCPREP_diffuse" in node:
         ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bpy_struct: this type doesn't support IDProperties
  • Prep materials:
File "/home/mahid/.config/blender/5.0/scripts/addons/MCprep_addon/materials/generate.py", line 564, in get_textures
    elif "MCPREP_diffuse" in node:
         ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bpy_struct: this type doesn't support IDProperties

This is due to a recent change in Blender in how properties can be accessed. To quote the release notes

Removal of (Unsuported) Access to Runtime-Defined Properties Storage Data

Properties defined by the bpy.props API are no longer stored in the same container as user-defined Custom Properties. As a consequence, it is no more possible to access them directly through the Python 'dict-like' syntax.

E.g. bpy.context.scene['cycles'] will not give access to Cycles' scene settings.

Based on what I can tell in the accompanying issue thread, the new changes in Blender 5.0 massively restrict what addons can modify at runtime. I've yet to do a deep dive on how this impacts us specifically, but we should be expecting some massive refactoring at the very least.

What steps are needed to produce the bug?

  1. Run Blender 5.0
  2. Use either the block spawner, rig spawner, or prep materials functions

What version of MCprep are you using?

3.7-MB-3, which is everything currently on the dev branch (though I would assume this impacts the latest stable release)

What version of Blender are you using?

Blender 5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions