ID Management: Sanitize and clarify our ID creation/copy tags #90610

Open
opened 2021-08-11 16:31:18 +02:00 by Bastien Montagne · 4 comments

Some of our ID creation/copying code and flags are currently still fuzzy and not really correct, especially when changes proposed in #88555 (ID Management: Sanitize and clarify our ID tags) become real. This concerns 'out of G_MAIN' IDs mostly.

IMPORTANT: This task is a sister of #88555 (ID Management: Sanitize and clarify our ID tags), both will be worked on together.

LIB_ID_CREATE_LOCALIZE

This ID creation flag is only used in two places, and its name is extremely confusing since it actually sets NO_MAIN flag, not LOCALIZED one. It should simply be removed.

LIB_ID_COPY_LOCALIZE

Should be updated to set LOCALIZED flag instead of NO_MAIN one: LIB_ID_CREATE_LOCAL | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_LIB_OVERRIDE

A new LIB_ID_COPY_NO_MAIN set of flags should be added with default behavior to create a NO_MAIN ID, probably LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES | LIB_ID_COPY_NO_LIB_OVERRIDE (would leave NO_REF_COUNT out of the default set of flags).

ntreeLocalize

This special function needs to be removed, this specific behavior should be strictly handled through calls to generic BKE_id_copy_ex and dedicated code in ntree_copy_data IDType callback.

Not sure where the recursive copying of sub-trees should be handled though, either in BKE_id_copy_ex or BKE_libblock_copy_ex, in a similar way to how we deal with animation data currently, or from ntree_copy_data, as done e.g. for shapekeys for meshes and other obdata?
Would rather keep this 'localize' behavior in the ntree_copy_data i think, at least for now. We need a full rethink of how we handle recursive 'deep' copying of IDs anyway, current code is dodgy at best here, and often fully broken (ref. #72659 (Making 'singleuser' for a group with too smart NodeCustomGroup breaks user counters of both source and target nodes) and similar).

Some of our ID creation/copying code and flags are currently still fuzzy and not really correct, especially when changes proposed in #88555 (ID Management: Sanitize and clarify our ID tags) become real. This concerns 'out of `G_MAIN`' IDs mostly. IMPORTANT: This task is a sister of #88555 (ID Management: Sanitize and clarify our ID tags), both will be worked on together. ## `LIB_ID_CREATE_LOCALIZE` This ID creation flag is only used in two places, and its name is extremely confusing since it actually sets `NO_MAIN` flag, not `LOCALIZED` one. It should simply be removed. ## `LIB_ID_COPY_LOCALIZE` Should be updated to set `LOCALIZED` flag instead of `NO_MAIN` one: `LIB_ID_CREATE_LOCAL | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_LIB_OVERRIDE` A new `LIB_ID_COPY_NO_MAIN` set of flags should be added with default behavior to create a `NO_MAIN` ID, probably `LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES | LIB_ID_COPY_NO_LIB_OVERRIDE` (would leave `NO_REF_COUNT` out of the default set of flags). ## `ntreeLocalize` This special function needs to be removed, this specific behavior should be strictly handled through calls to generic `BKE_id_copy_ex` and dedicated code in `ntree_copy_data` IDType callback. Not sure where the recursive copying of sub-trees should be handled though, either in `BKE_id_copy_ex` or `BKE_libblock_copy_ex`, in a similar way to how we deal with animation data currently, or from `ntree_copy_data`, as done e.g. for shapekeys for meshes and other obdata? *Would rather keep this 'localize' behavior in the `ntree_copy_data` i think, at least for now. We need a full rethink of how we handle recursive 'deep' copying of IDs anyway, current code is dodgy at best here, and often fully broken (ref. #72659 (Making 'singleuser' for a group with too smart NodeCustomGroup breaks user counters of both source and target nodes) and similar).*
Author
Owner

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

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

Added subscriber: @mont29

Added subscriber: @mont29

Added subscriber: @brecht

Added subscriber: @brecht

This seems fine.

This seems fine.
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:43:10 +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
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#90610
No description provided.