Selecting "Remove unused slots" in Materials panel removes slots that are assigned to particle systems/hair #91691

Closed
opened 2021-09-24 21:02:10 +02:00 by Nikhil Shringarpurey · 10 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 471.68

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-09-24 14:03, hash: 95ec6e4dd3
Worked: never

Short description of error
In the Material panel in the Properties editor, there is a drop-down next to the material slots. Selecting "Remove unused slots" will remove materials that are assigned to particle systems/hair. So it seems unless material slots are assigned to at least one face, this function deletes their slots.

Exact steps for others to reproduce the error

  • Add 2 material slots to the default cube - Slot 1: skin and Slot 2: hair.
  • Ensure the skin material is applied to all faces of the cube
  • Add a hair particle system
  • Under the Particle System's Render tab, select the hair material slot.
  • Render to ensure materials are assigned correctly.
  • Return to the material tab in the properties editor and click the "Remove unused slots" option from the drop-down

Watch the hair material slot be deleted.


or

  • Open .blend file
  • Switch Viewport Shading to Material Preview

In material Properties: Material Specials -> Remove Unused Slots

Test File:
#91691.blend

**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 471.68 **Blender Version** Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-09-24 14:03, hash: `95ec6e4dd3` Worked: never **Short description of error** In the Material panel in the Properties editor, there is a drop-down next to the material slots. Selecting "Remove unused slots" will remove materials that are assigned to particle systems/hair. So it seems unless material slots are assigned to at least one face, this function deletes their slots. **Exact steps for others to reproduce the error** - Add 2 material slots to the default cube - Slot 1: skin and Slot 2: hair. - Ensure the skin material is applied to all faces of the cube - Add a hair particle system - Under the Particle System's Render tab, select the hair material slot. - Render to ensure materials are assigned correctly. - Return to the material tab in the properties editor and click the "Remove unused slots" option from the drop-down # Watch the hair material slot be deleted. --- or - Open .blend file - Switch Viewport Shading to `Material Preview` # In material Properties: `Material Specials -> Remove Unused Slots` Test File: [#91691.blend](https://archive.blender.org/developer/F10585208/T91691.blend)
Author
Member

Added subscriber: @Nikhil.Net

Added subscriber: @Nikhil.Net
Author
Member

This appears to be a shortcoming in the "bool BKE_object_material_slot_used(ID *id, short actcol)" function in material.c from what I can tell. I can work on a fix if others agree this behavior is not good.

This appears to be a shortcoming in the "bool BKE_object_material_slot_used(ID *id, short actcol)" function in material.c from what I can tell. I can work on a fix if others agree this behavior is not good.
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Hi, thanks for the report. I think the option removes the materials which are not linked to any object.

Not quite sure if this is expected output. Will leave this for other triagers, developers to check.

Hi, thanks for the report. I think the option removes the materials which are not linked to any object. Not quite sure if this is expected output. Will leave this for other triagers, developers to check.
Author
Member

In #91691#1225773, @PratikPB2123 wrote:
Hi, thanks for the report. I think the option removes the materials which are not linked to any object.

Not quite sure if this is expected output. Will leave this for other triagers, developers to check.

Thanks, Pratik. Yes, it currently only loops thru all MPoly's and all MFace's and checks if those have the material assigned. The real logic appears to exist in mesh.c at line 1447. The method is called "BKE_mesh_material_index_used(...)"

> In #91691#1225773, @PratikPB2123 wrote: > Hi, thanks for the report. I think the option removes the materials which are not linked to any object. > > Not quite sure if this is expected output. Will leave this for other triagers, developers to check. Thanks, Pratik. Yes, it currently only loops thru all MPoly's and all MFace's and checks if those have the material assigned. The real logic appears to exist in mesh.c at line 1447. The method is called "BKE_mesh_material_index_used(...)"

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Apparently this operator only considers a material to be "used" if any face has the material assigned.
But the particles assigned to the object may be using the material, so it's technically being "used".
So I'm considering it as a bug, either because of the functionality or because of the Operator's description.

Apparently this operator only considers a material to be "used" if any face has the material assigned. But the particles assigned to the object may be using the material, so it's technically being "used". So I'm considering it as a bug, either because of the functionality or because of the Operator's description.

This issue was referenced by 6578db57cd

This issue was referenced by 6578db57cd878a94bdbdabe953c8819625c5a811

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2021-09-27 18:09:42 +02:00
Thomas Dinges added this to the 3.0 milestone 2023-02-08 15:59:02 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 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#91691
No description provided.