Material Utilities Addon can't get all materials? #100387

Closed
opened 2022-08-13 14:29:08 +02:00 by RedHaloStudio · 12 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94

Blender Version
Broken: version: 3.4.0 Alpha, branch: master, commit date: 2022-08-11 23:16, hash: blender/blender@282a861e11
Worked: ?

Short description of error
The Material Utilities add-on fails to display all materials, because it attempts to access material.preview.icon_id for grease pencil materials, which do not have a preview.

Traceback (most recent call last):
  File "Z:\02_software\blender-3.4.0-alpha+master.b5e92c3dfe70-windows.amd64-release\3.4\scripts\addons\materials_utils\menus.py", line 57, in draw
    icon_value = material.preview.icon_id)
AttributeError: 'NoneType' object has no attribute 'icon_id'

BUG.jpg

Exact steps for others to reproduce the error

  • Enable the Material Utilities add-on
  • Switch the Display Mode of the Outliner to Blender File and open the materials section
  • Press Shift + Q and choose Assign Material
  • Observe missing materials and error on console
**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94 **Blender Version** Broken: version: 3.4.0 Alpha, branch: master, commit date: 2022-08-11 23:16, hash: `blender/blender@282a861e11` Worked: ? **Short description of error** The Material Utilities add-on fails to display all materials, because it attempts to access `material.preview.icon_id` for grease pencil materials, which do not have a preview. ``` Traceback (most recent call last): File "Z:\02_software\blender-3.4.0-alpha+master.b5e92c3dfe70-windows.amd64-release\3.4\scripts\addons\materials_utils\menus.py", line 57, in draw icon_value = material.preview.icon_id) AttributeError: 'NoneType' object has no attribute 'icon_id' ``` ![BUG.jpg](https://archive.blender.org/developer/F13376879/BUG.jpg) **Exact steps for others to reproduce the error** - Enable the Material Utilities add-on - Switch the *Display Mode* of the Outliner to *Blender File* and open the materials section - Press Shift + Q and choose *Assign Material* - Observe missing materials and error on console
Author

Added subscriber: @HMRP

Added subscriber: @HMRP

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

The "Dots Stroke" material is a default material created for grease pencil brush strokes. Hence, it is not an assignable material for meshes. Could you please explain which exact steps result in an error message being displayed?

The "Dots Stroke" material is a default material created for grease pencil brush strokes. Hence, it is not an assignable material for meshes. Could you please explain which exact steps result in an error message being displayed?
Author

In #100387#1403440, @rjg wrote:
The "Dots Stroke" material is a default material created for grease pencil brush strokes. Hence, it is not an assignable material for meshes. Could you please explain which exact steps result in an error message being displayed?

Loading Factory Setting or delete all blender profiles,open blender appliation, the material 'Dots Stroke' will display in outline

> In #100387#1403440, @rjg wrote: > The "Dots Stroke" material is a default material created for grease pencil brush strokes. Hence, it is not an assignable material for meshes. Could you please explain which exact steps result in an error message being displayed? Loading Factory Setting or delete all blender profiles,open blender appliation, the material 'Dots Stroke' will display in outline

I'm aware that this material always exists, hence I stated that it is the default material for grease pencil brush strokes. It is therefore correct, that the add-on does not allow to select this material for meshes as it is only for grease pencil. What I was asking about was your reference to "Material_utils/menus.py-> line 57". Is there any exception raised in this particular line if you interact with the add-on or is this the line you believed to be incorrectly implemented?

I'm aware that this material always exists, hence I stated that it is the default material for grease pencil brush strokes. It is therefore correct, that the add-on does not allow to select this material for meshes as it is only for grease pencil. What I was asking about was your reference to "Material_utils/menus.py-> line 57". Is there any exception raised in this particular line if you interact with the add-on or is this the line you believed to be incorrectly implemented?
Author

This add-on fetches all materials, including grease pencil brush, but this material does not have the icon_id attribute, so the first 2 commands of this add-on will report an error.
这个插件会获取所有材质,包括蜡笔的材质。但是这个材质又没有 icon_id这个属性,所以这个插件的前2个命令都会报错。

GIF 2022-08-15 16-06-22.gif

This add-on fetches all materials, including grease pencil brush, but this material does not have the icon_id attribute, so the first 2 commands of this add-on will report an error. 这个插件会获取所有材质,包括蜡笔的材质。但是这个材质又没有 icon_id这个属性,所以这个插件的前2个命令都会报错。 ![GIF 2022-08-15 16-06-22.gif](https://archive.blender.org/developer/F13386893/GIF_2022-08-15_16-06-22.gif)

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

Apologies for the misunderstanding on my part.

The add-on does not support grease pencil materials. The attempt to access the non-existent icon_id for grease pencil materials is one of several issues. Currently, the add-on also does not check whether the material can be assigned to the particular object type. In the current state in Blender 3.4.0 it does not appear to be useable at all.

There is a more recent version that is supposed to address these issues on @ChristopherHindefjord's GitHub , but it has not been merged into Blender yet. The open ticket for this is #90683.

Apologies for the misunderstanding on my part. The add-on does not support grease pencil materials. The attempt to access the non-existent `icon_id` for grease pencil materials is one of several issues. Currently, the add-on also does not check whether the material can be assigned to the particular object type. In the current state in Blender 3.4.0 it does not appear to be useable at all. There is a more recent version that is supposed to address these issues on @ChristopherHindefjord's [GitHub ](https://github.com/ChrisHinde/MaterialUtilities), but it has not been merged into Blender yet. The open ticket for this is #90683.

Added subscriber: @ChristopherHindefjord

Added subscriber: @ChristopherHindefjord

As a side note, Blender's Python API should probably prevent grease pencil materials from being assigned to meshes.

As a side note, Blender's Python API should probably prevent grease pencil materials from being assigned to meshes.
Member

Fixed in 932ed7422d.

Fixed in 932ed7422d.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-12-20 21:00:58 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#100387
No description provided.