How to handle preservations of linked IDs when they are effectively unused. #106321

Open
opened 2023-03-30 17:55:27 +02:00 by Bastien Montagne · 4 comments

133dde41bb refactored how linked data 'directly linked' versus 'indirectly linked' status is handled in code, such that only linked IDs effectively used in current blend file are tagged as 'directly linked'.

This broke some existing use-case, where previous broken behavior was 'abused' to keep linked IDs in current .blend files even if they did not have actual real local usages. E.g. Texts data-blocks, or node groups... See #103867, #105687, #105786, and 'fixes' commits a60f651502 and 3d49d738b7.

A better solution than these temp hacks is needed. Here are two different proposals.

1. Keep track of IDs explicitly linked by users.

The idea here is to add a new flag to IDs, which would only be set for linked IDs that were actually selected by the user (as opposed to these implicitly linked as their dependencies).

These explicitly linked IDs would then always be kept in current blend file, unless users explicitly delete them (through regular ID deletion or Purge operation e.g.).

The 'Fake User' flag would then be fully ignored on linked data.

This solution would also help in case 'fake user' gets removed in the future? See #61209.

2. Make 'Fake User' Editable on Linked Data.

'Fake User' would be editable on linked data. Linked IDs with this flag set would always be considered as directly linked.

When linking a new ID, the value of the 'Fake User' flag in the library file would be ignored. Instead, the Fake User flag would be set or cleared based on the ID type (in a similar way as some ID types currently get a fake user by default on creation, e.g. texts)
This would imply adding a new IDType flag to identify such ID types, which would be a good side-cleanup thing.


This task is closely related to #99262.

133dde41bb refactored how linked data 'directly linked' versus 'indirectly linked' status is handled in code, such that only linked IDs effectively used in current blend file are tagged as 'directly linked'. This broke some existing use-case, where previous broken behavior was 'abused' to keep linked IDs in current .blend files even if they did not have actual real local usages. E.g. Texts data-blocks, or node groups... See #103867, #105687, #105786, and 'fixes' commits a60f651502 and 3d49d738b7. A better solution than these temp hacks is needed. Here are two different proposals. ### 1. Keep track of IDs explicitly linked by users. The idea here is to add a new flag to IDs, which would only be set for linked IDs that were actually selected by the user (as opposed to these implicitly linked as their dependencies). These explicitly linked IDs would then always be kept in current blend file, unless users explicitly delete them (through regular ID deletion or Purge operation e.g.). The 'Fake User' flag would then be fully ignored on linked data. This solution would also help in case 'fake user' gets removed in the future? See #61209. ### 2. Make 'Fake User' Editable on Linked Data. 'Fake User' would be editable on linked data. Linked IDs with this flag set would always be considered as directly linked. When linking a new ID, the value of the 'Fake User' flag in the library file would be ignored. Instead, the Fake User flag would be set or cleared based on the ID type (in a similar way as some ID types currently get a fake user by default on creation, e.g. texts) *This would imply adding a new IDType flag to identify such ID types, which would be a good side-cleanup thing.* ------------------ This task is closely related to #99262.
Bastien Montagne added the
Type
Design
Module
Core
Status
Confirmed
labels 2023-03-30 17:56:00 +02:00
Bastien Montagne added this to the 3.6 LTS milestone 2023-03-30 17:56:12 +02:00

Subscribed

*Subscribed*

@brecht @dfelinto you guys have any opinions regarding proposed solutions, or other ideas? Think it would be good to properly address that issue for 3.6 LTS.

@brecht @dfelinto you guys have any opinions regarding proposed solutions, or other ideas? Think it would be good to properly address that issue for 3.6 LTS.

@SimonThommes @eyecandy @Mets You guys may also have some ideas here?

@SimonThommes @eyecandy @Mets You guys may also have some ideas here?

I think we should have a discussion to figure out where we want to go with fake users and reference counting in general, and what we can change in 4.0, before committing to a solution here. Since it might change the conclusion.

(1) and (2) in a way are not that different. If "explicitly linked" is user editable it's like a local "fake user"? And the "fake user" from the original .blend is not relevant when linked, so in the UI that can be replaced with this.

For both #103867 and #105687 I think the proper solution is not to rely on this though. If a rig needs a script, we should have some way of attaching that script to the rig instead so it comes along and gets removed automatically as needed. For an add-on using a node group, it should also be linked through a custom property I think.

I think we should have a discussion to figure out where we want to go with fake users and reference counting in general, and what we can change in 4.0, before committing to a solution here. Since it might change the conclusion. (1) and (2) in a way are not that different. If "explicitly linked" is user editable it's like a local "fake user"? And the "fake user" from the original .blend is not relevant when linked, so in the UI that can be replaced with this. For both #103867 and #105687 I think the proper solution is not to rely on this though. If a rig needs a script, we should have some way of attaching that script to the rig instead so it comes along and gets removed automatically as needed. For an add-on using a node group, it should also be linked through a custom property I think.
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
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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
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#106321
There is no content yet.