Garbage materials with no users are saved. #49568

Closed
opened 2016-10-04 17:17:05 +02:00 by Vyacheslav Kobozev · 8 comments

System Information
win7 x64

Blender Version
2.78

Short description of error
I found, that materials without users was saved. After resaving, they gone from main file, but still in the backup.

Garbage.7z

**System Information** win7 x64 **Blender Version** 2.78 **Short description of error** I found, that materials without users was saved. After resaving, they gone from main file, but still in the backup. [Garbage.7z](https://archive.blender.org/developer/F373809/Garbage.7z)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @Vyach

Added subscriber: @Vyach

Added subscriber: @mont29

Added subscriber: @mont29

Though this should not happen with new data-blocks handling code, this is how things have been working in Blender since ever…

Unless you can provide us a clear and detailed way to reproduce getting those materials with bad user count, we can’t do anything.

Though this should not happen with new data-blocks handling code, this is how things have been working in Blender since ever… Unless you can provide us a clear and detailed way to reproduce getting those materials with bad user count, we can’t do anything.

I found how to reproduce this

  1. for the initial i have file with few lights and one basic material (duffuse+glossy cycles shader), that assigned to fake user. And duplicating materials with Shift+D in my settings.

  2. New file. Select and delete all. Add box. Add material slot to Object, assign those basic material to object, click to F to clear fake user

  3. Now switch to Data and add material slot for data. And assign Basic material again, then make it unique and change color and name just to be sure.

  4. Duplicate box few times. It will make few copies of both materials (assigned to data and to object).

  5. Save file.

  6. Select all, delete, save file, close Blender. Open Blender again, open this file again.

  7. Add box and check what materials you can assign to it. I see all materials that was assigned to data, but all materials assigned to object was gone.

my dupl settings.jpg
my initial file.7z
garbage2.7z — result

I found how to reproduce this 1. for the initial i have file with few lights and one basic material (duffuse+glossy cycles shader), that assigned to fake user. And duplicating materials with Shift+D in my settings. 2. New file. Select and delete all. Add box. Add material slot to Object, assign those basic material to object, click to F to clear fake user 3. Now switch to Data and add material slot for data. And assign Basic material again, then make it unique and change color and name just to be sure. 4. Duplicate box few times. It will make few copies of both materials (assigned to data and to object). 5. Save file. 6. Select all, delete, save file, close Blender. Open Blender again, open this file again. 7. Add box and check what materials you can assign to it. I see all materials that was assigned to data, but all materials assigned to object was gone. ![my dupl settings.jpg](https://archive.blender.org/developer/F376060/my_dupl_settings.jpg) [my initial file.7z](https://archive.blender.org/developer/F376062/my_initial_file.7z) [garbage2.7z](https://archive.blender.org/developer/F376063/garbage2.7z) — result

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2016-10-10 10:09:34 +02:00

Ahhh… OK.

So there is no bug here in fact, what happens is that materials assigned to obdata (meshes etc.) 'belong' to those data, not to the object. When you delete the object, the meshes remain available, so their materials are still used by those meshes.

First save and reload will clear the meshes (since those had zero users), and next save and reload will clear the meshes' materials.

Ahhh… OK. So there is no bug here in fact, what happens is that materials assigned to obdata (meshes etc.) 'belong' to those data, not to the object. When you delete the object, the meshes remain available, so their materials are still used by those meshes. First save and reload will clear the meshes (since those had zero users), and next save and reload will clear the meshes' materials.

Oh! I understand now how it works!
There is not hiererchical checking and deleting.

I think, it will be useful to have special clear button, that checks all unused data through the file and clear it immediately without 2 reloadings of file. I see why saving of data is made, it is useful to keep it from accidental loosing. But clearing will add balance to it. Just because sometimes you need to get rid of unwanted datas from lists (materials, meshes, textures) that appears after editing, testing and copying different versions.

Btw where I can suggest this to developers?

Oh! I understand now how it works! There is not hiererchical checking and deleting. I think, it will be useful to have special clear button, that checks all unused data through the file and clear it immediately without 2 reloadings of file. I see why saving of data is made, it is useful to keep it from accidental loosing. But clearing will add balance to it. Just because sometimes you need to get rid of unwanted datas from lists (materials, meshes, textures) that appears after editing, testing and copying different versions. Btw where I can suggest this to developers?
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
2 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#49568
No description provided.