Skip to content

Material.name is read-only error in Blender 4.3 (possible API change) #192

Description

@hiyakake

Disclaimer:
This issue report is based on an analysis of the error log using ChatGPT (o3) and may not be entirely accurate or comprehensive.

Description:
When using the latest Git version (The_Lightmapper-master) with Blender 4.3, running the lightmap build operator results in the following error:

Library read: "/Volumes/DATA-SSD/Metaverse/Poly Haven/plastered_wall_03/plastered_wall_03.blend" "/Volumes/DATA-SSD/Metaverse/Poly Haven/plastered_wall_03/plastered_wall_03.blend" (parent: "")
bpy.ops.tlm.build_lightmaps()
Python: Traceback (most recent call last):
File "/Users/udon/Library/Application Support/Blender/4.3/scripts/addons/The_Lightmapper-master/addon/operators/tlm.py", line 52, in invoke
build.prepare_build(self, False)
File "/Users/udon/Library/Application Support/Blender/4.3/scripts/addons/The_Lightmapper-master/addon/utility/build.py", line 104, in prepare_build
naming_check()
File "/Users/udon/Library/Application Support/Blender/4.3/scripts/addons/The_Lightmapper-master/addon/utility/build.py", line 1250, in naming_check
slot.material.name = slot.material.name.replace("_",".")
^^^^^^^^^^^^^^^^^^
AttributeError: bpy_struct: attribute "name" from "Material" is read-only

Steps to Reproduce:
1. Launch Blender 4.3.
2. Install the latest Git version of The_Lightmapper (The_Lightmapper-master).
3. Open the scene (e.g., plastered_wall_03.blend) and execute bpy.ops.tlm.build_lightmaps().
4. The error appears as shown above.

Expected Behavior:
Lightmaps should be built correctly without errors in Blender 4.3.

Actual Behavior:
An AttributeError is raised because the code attempts to modify slot.material.name, which is read-only in Blender 4.3.

Analysis:
It appears that with Blender 4.3, the API has been tightened so that ID data-blocks (such as Material) have their name property set to read-only in order to maintain internal consistency. This prevents direct assignment (e.g., Material.name = ...). As a result, the operation in the naming_check() function that attempts to replace underscores with dots fails.

Environment:
• Blender 4.3
• The_Lightmapper-master (latest Git version 2025/02/09)
• macOS

Additional Notes:
This error prevents the lightmap generation from completing. A potential fix would be to adjust the name replacement logic (for example, by duplicating the material and renaming the duplicate or by catching and ignoring this error) or to modify the code so that it no longer writes to the name property. It is believed that this issue stems from an API change in Blender 4.3 regarding read-only properties for ID data-block names.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions