Reordering locally added items in overridden Collection Property breaks after saving #99924

Closed
opened 2022-07-23 03:33:42 +02:00 by blenderboi · 7 comments

System Information
Operating system: Linux-5.18.12-arch1-1-x86_64-with-glibc2.35 64 Bits
Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 515.57

Blender Version
Broken: version: 3.2.1, branch: master, commit date: 2022-07-05 15:44, hash: a2d59b2dac
Worked: (newest version of Blender that worked as expected)

Short description of error

When an object that has a Collection Property which allows Library Overrides, with INSERTION on, one can add new item into it.

I assume it is designed to

  1. cannot remove existing item
  2. cannot move (change the order) of the existing item,

However, while you cannot change the existing item's order directly, you can change its order my moving locally added items
and this will cause things break after you reopen Blender, this only happens if you move added items into slot 1 or slot 2

Exact steps for others to reproduce the error

  1. Install the TestAddon.py as Addon
  2. Open a New Empty Blend File
  3. Link the Cube Object from LinkTest.blend to the new blend file
  4. Create Library Overrides from the Linked Cube Object
  5. Select the Library Overrides Cube and Open N-Panel -> TestPanel
  6. Click Up / Down button in the Addon (Error is Expected as it is not handled in the addon, this is expected behaviour as you cannot move existing items)
  7. Click Add Slot
  8. Click Up with the previously added Slot as active (No Error and You have reordered the Slot that is not suppose to be moved [I assume])
  9. Move the Added Slot to Slot 0 or Slot 1 (Both will cause the problem)
  10. Save the blend file
  11. Reopen the blend file
  12. the Items in the Collection Property is now Messed up, added item is turn into duplicated slot of the existing slot, and cannot to removed / reordered

Test Addon:
TestAddon.py

Test Blend File:
LinkTest.blend

**System Information** Operating system: Linux-5.18.12-arch1-1-x86_64-with-glibc2.35 64 Bits Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 515.57 **Blender Version** Broken: version: 3.2.1, branch: master, commit date: 2022-07-05 15:44, hash: `a2d59b2dac` Worked: (newest version of Blender that worked as expected) **Short description of error** When an object that has a Collection Property which allows Library Overrides, with INSERTION on, one can add new item into it. I assume it is designed to 1. cannot remove existing item 2. cannot move (change the order) of the existing item, However, while you cannot change the existing item's order directly, you can change its order my moving locally added items and this will cause things break after you reopen Blender, this only happens if you move added items into slot 1 or slot 2 **Exact steps for others to reproduce the error** 1. Install the TestAddon.py as Addon 2. Open a New Empty Blend File 3. Link the Cube Object from LinkTest.blend to the new blend file 4. Create Library Overrides from the Linked Cube Object 5. Select the Library Overrides Cube and Open N-Panel -> TestPanel 6. Click Up / Down button in the Addon (Error is Expected as it is not handled in the addon, this is expected behaviour as you cannot move existing items) 7. Click Add Slot 8. Click Up with the previously added Slot as active (No Error and You have reordered the Slot that is not suppose to be moved [I assume]) 9. Move the Added Slot to Slot 0 or Slot 1 (Both will cause the problem) 10. Save the blend file 11. Reopen the blend file 12. the Items in the Collection Property is now Messed up, added item is turn into duplicated slot of the existing slot, and cannot to removed / reordered Test Addon: [TestAddon.py](https://archive.blender.org/developer/F13309346/TestAddon.py) Test Blend File: [LinkTest.blend](https://archive.blender.org/developer/F13309350/LinkTest.blend)
Author

Added subscriber: @blenderboi2018

Added subscriber: @blenderboi2018
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

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

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

As far as I can see in the code, reordering items that are inserted in the local override is allowed. So this looks like a bug.

As far as I can see in the code, reordering items that are inserted in the local override is allowed. So this looks like a bug.
Omar Emara changed title from Library Overrides and Collection Property to Reordering locally added items in overridden Collection Property breaks after saving 2022-08-02 10:30:20 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'

The problem here is that you are using NO_PROPERTY_NAME option for your collection, which means that the diffing code has no way to detect re-ordering, since there is no 'unique identifier' for the items.

So you do can insert items after the existing ones from lib data, but not move them before lib data ones.

In general NO_PROPERTY_NAME should really be avoided, it makes handling of any change in source (lib) data also extremely likely to break things. Without some kind of unique identifier (the name), dealing correctly with changes in a list is close to impossible.

note that if you want the user-visible name to be non-unique, you can always use another hidden string property for your items' names, which you can easily ensure that they are unique.

The problem here is that you are using `NO_PROPERTY_NAME` option for your collection, which means that the diffing code has no way to detect re-ordering, since there is no 'unique identifier' for the items. So you do can insert items after the existing ones from lib data, but not move them before lib data ones. In general `NO_PROPERTY_NAME` should really be avoided, it makes handling of any change in source (lib) data also extremely likely to break things. Without some kind of unique identifier (the name), dealing correctly with changes in a list is close to impossible. note that if you want the user-visible name to be non-unique, you can always use another hidden string property for your items' names, which you can easily ensure that they are unique.
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
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#99924
No description provided.