How to handle 'fake user' in linked data. #99262

Closed
opened 2022-06-29 10:22:35 +02:00 by Ludvik Koutny · 12 comments
Contributor

Currently, linked data keep their 'fake user' flag as defined in the source library. This is not editable by the user.

The problem is that this creates linked data that are never automatically/manually purged once unused, user needs to manually delete those IDs.

There are several potential ways to address that issue:

1 Clear Fake User flag on linked data


  • This would have to be applied in readfile code for all linked data.
  • It is easy to implement.
  • One side-effect is that appending would not preserve that information either (unless we add some specific special-case code, which I would rather avoid here).

2 Ignore fake user flag on linked data in purge-like operations


(actual purge operator and/or 'clear on file write' current behavior).

  • This would not change anything to current behavior, besides removing unused linked data even when it has a (library-defined) fake user.
    ** One of the questions here is whether 'removal on file write' type of cleanup should also behave that way, or only the actual Purge operator.
  • It is easy to implement.
  • The difference with option 1 is that the fake user flag would be automatically preserved when appending (or making linked data local).

3 Allow local definition/storage of 'fake user' flag for linked data


  • User would be able to set or clear fake user on linked data.
  • Probably need a specific handling on first linking, e.g. using value from linked data for directly linked ones, and always clearing it for indirectly linked IDs.
  • Status would be stored in the 'place-holder' ID header used in blendfile to keep reference to the directly linked IDs.
    ** Implies that indirectly linked IDs would become directly linked if user set a fake user for them (which makes sense anyway I believe).
  • Probably the most complex/risky option to implement.
    ** May raise unforeseen issues, and/or have unexpected consequences.

Original report:

Linking data from other blend files leaves the target file with link references which have to be removed manually

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.59

Blender Version
Broken: version: 3.2.2, branch: SelectThrough, commit date: 2022-06-08 07:44, hash: a9ace42a16
Worked: probably never

Short description of error
When linking objects or data from other .blend files, the target blend file is infected with references to the linked file, as well as any files the linked file was linking. These references remain in the target file even after all objects are removed an all the various clean up operators are ran. This is probably due to incorrect handling of linked data blocks if they are fake-usered.

2022-06-29 10-15-50.mp4

Exact steps for others to reproduce the error

  1. Create a blend file with some datablocks, some of which are fake-usered.
  2. Open a new blank file, and link some datablocks from the previous file, which reference some datablocks which have been fake-usered.
  3. Delete any of the data you have just linked, and run all 3 recursive versions of the clean up operators.
    Result: The references to the linked files are still present in the target blend file
    Expected: The references to the linked files are gone if they are not used
Currently, linked data keep their 'fake user' flag as defined in the source library. This is not editable by the user. The problem is that this creates linked data that are never automatically/manually purged once unused, user needs to manually delete those IDs. There are several potential ways to address that issue: 1 Clear Fake User flag on linked data **** * This would have to be applied in readfile code for all linked data. * It is easy to implement. * One side-effect is that appending would not preserve that information either *(unless we add some specific special-case code, which I would rather avoid here)*. 2 Ignore fake user flag on linked data in purge-like operations **** (actual purge operator and/or 'clear on file write' current behavior). * This would not change anything to current behavior, besides removing unused linked data even when it has a (library-defined) fake user. ** One of the questions here is whether 'removal on file write' type of cleanup should also behave that way, or only the actual Purge operator. * It is easy to implement. * The difference with option **1** is that the fake user flag would be automatically preserved when appending (or making linked data local). 3 Allow local definition/storage of 'fake user' flag for linked data **** * User would be able to set or clear fake user on linked data. * Probably need a specific handling on first linking, e.g. using value from linked data for directly linked ones, and always clearing it for indirectly linked IDs. * Status would be stored in the 'place-holder' ID header used in blendfile to keep reference to the directly linked IDs. ** Implies that indirectly linked IDs would become directly linked if user set a fake user for them *(which makes sense anyway I believe)*. * Probably the most complex/risky option to implement. ** May raise unforeseen issues, and/or have unexpected consequences. ----------------------- **Original report:** *Linking data from other blend files leaves the target file with link references which have to be removed manually* **System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.59 **Blender Version** Broken: version: 3.2.2, branch: SelectThrough, commit date: 2022-06-08 07:44, hash: `a9ace42a16` Worked: probably never **Short description of error** When linking objects or data from other .blend files, the target blend file is infected with references to the linked file, as well as any files the linked file was linking. These references remain in the target file even after all objects are removed an all the various clean up operators are ran. This is probably due to incorrect handling of linked data blocks if they are fake-usered. [2022-06-29 10-15-50.mp4](https://archive.blender.org/developer/F13237010/2022-06-29_10-15-50.mp4) **Exact steps for others to reproduce the error** 1. Create a blend file with some datablocks, some of which are fake-usered. 2. Open a new blank file, and link some datablocks from the previous file, which reference some datablocks which have been fake-usered. 3. Delete any of the data you have just linked, and run all 3 recursive versions of the clean up operators. Result: The references to the linked files are still present in the target blend file Expected: The references to the linked files are gone if they are not used
Author
Contributor

Added subscriber: @Rawalanche

Added subscriber: @Rawalanche
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

I'm seeing that data block is marked as fake user in outliner->orphaned data tab. That's why those cleanup operations are not removing unused data block.
I think Bastien knows if this is working as expected or not

I'm seeing that data block is marked as fake user in `outliner->orphaned data` tab. That's why those cleanup operations are not removing unused data block. I think Bastien knows if this is working as expected or not

Added subscribers: @mont29, @mano-wii

Added subscribers: @mont29, @mano-wii

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Okay, if I understand correctly, the problem is that if you link a data-block with fake-user, it will also have fake-user in the new scene and so it won't be removed in any recursive purge operation.

I'm not sure if this should be considered a bug.

Why does the data-block have a fake-user to begin with?

But I agree this behavior is a bit strange. Should the fake-user be removed/ignored in the link?

Needs Information from Developers... (@mont29?)

Okay, if I understand correctly, the problem is that if you link a data-block with fake-user, it will also have fake-user in the new scene and so it won't be removed in any recursive purge operation. I'm not sure if this should be considered a bug. Why does the data-block have a fake-user to begin with? But I agree this behavior is a bit strange. Should the fake-user be removed/ignored in the link? Needs Information from Developers... (@mont29?)
Author
Contributor

In #99262#1382950, @mano-wii wrote:
Why does the data-block have a fake-user to begin with?

How is that a question? Because I don't want Blender to blatantly delete my data when working with the source file I linked. Isn't that obvious?

Or is your question specifically why does it have a fake user in the file it was linked to? In that case, the answer would be it's a bug. It does not make sense to consider fake user state of a linked datablock, because the target file can not affect/write to the linked file, and therefore delete that data somehow.

> In #99262#1382950, @mano-wii wrote: > Why does the data-block have a fake-user to begin with? How is that a question? Because I don't want Blender to blatantly delete my data when working with the source file I linked. Isn't that obvious? Or is your question specifically why does it have a fake user in the file it was linked to? In that case, the answer would be it's a bug. It does not make sense to consider fake user state of a linked datablock, because the target file can not affect/write to the linked file, and therefore delete that data somehow.

Added subscribers: @SimonThommes, @eyecandy, @dfelinto

Added subscribers: @SimonThommes, @eyecandy, @dfelinto

Thanks for the report, however this is not a bug, in the sense that the code is working as intended.

This requires design first, since deciding which behavior would be the best option in that case is not trivial. Will edit the task as such.

Also, CC @dfelinto @eyecandy @SimonThommes

Thanks for the report, however this is not a bug, in the sense that the code is working as intended. This requires design first, since deciding which behavior would be the best option in that case is not trivial. Will edit the task as such. Also, CC @dfelinto @eyecandy @SimonThommes
Bastien Montagne changed title from Linking data from other blend files leaves the target file with link references which have to be removed manually to How to handle 'fake user' in linked data. 2022-07-05 15:16:06 +02:00

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'
Author
Contributor

Solution 2. sounds the best. Solution 1 is also acceptable. Solution 3 sounds like a hell. There's already more than enough error prone data management wrangling Blender blatantly offloads onto user's mind. It would be really bad to add even more to it.

Solution 2. sounds the best. Solution 1 is also acceptable. Solution 3 sounds like a hell. There's already more than enough error prone data management wrangling Blender blatantly offloads onto user's mind. It would be really bad to add even more to it.
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:42:49 +01:00

Forgot about that report... Solution 1 has been committed as b3c7f3c8a9 and f052b18a65 a couple of weeks ago.

Forgot about that report... Solution 1 has been committed as b3c7f3c8a9 and f052b18a65 a couple of weeks ago.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-09-04 15:00:17 +02: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
4 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#99262
No description provided.