Modifier's persistent_uid are not correctly assigned when appending or opening objects prior 4.2 #125952

Closed
opened 2024-08-06 10:39:04 +02:00 by Julio Cargnin Pereira · 7 comments

System Information
Operating system: Linux-6.9.3-76060903-generic-x86_64-with-glibc2.35 64 Bits, X11 UI
Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 555.58.02

Blender Version
Broken: version: 4.2.1 Release Candidate, branch: blender-v4.2-release, commit date: 2024-08-05 13:24, hash: 174f8de75e63
Worked: (newest version of Blender that worked as expected)

Short description of error
Blender 4.2 can't assign modifier's persistent_uids when opening or appending objects created in earlier versions of Blender.

Exact steps for others to reproduce the error

  1. Assign couple modifiers to the default cube in Blender 3.6 LTS, for example.
  2. Save the file.
  3. In 4.2, append the object.
  4. Print the unique IDs with the script:
import bpy

# Function to print all modifiers and their unique IDs
def print_modifiers(obj):
    for mod in obj.modifiers:
        print(f"Modifier: {mod.name}, Unique ID: {mod.persistent_uid}")

# Example usage
obj = bpy.context.active_object
print_modifiers(obj)
  1. Notice their unique IDs are not random neither unique but just follow a linear increasing index.

Video for full contextualization:

Kind regards,
Cosmo.

**System Information** Operating system: Linux-6.9.3-76060903-generic-x86_64-with-glibc2.35 64 Bits, X11 UI Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 555.58.02 **Blender Version** Broken: version: 4.2.1 Release Candidate, branch: blender-v4.2-release, commit date: 2024-08-05 13:24, hash: `174f8de75e63` Worked: (newest version of Blender that worked as expected) **Short description of error** Blender 4.2 can't assign modifier's persistent_uids when opening or appending objects created in earlier versions of Blender. **Exact steps for others to reproduce the error** 1. Assign couple modifiers to the default cube in Blender 3.6 LTS, for example. 2. Save the file. 3. In 4.2, append the object. 4. Print the unique IDs with the script: ``` import bpy # Function to print all modifiers and their unique IDs def print_modifiers(obj): for mod in obj.modifiers: print(f"Modifier: {mod.name}, Unique ID: {mod.persistent_uid}") # Example usage obj = bpy.context.active_object print_modifiers(obj) ``` 5. Notice their unique IDs are not random neither unique but just follow a linear increasing index. Video for full contextualization: <video src="/attachments/6cf20751-69df-44eb-be0c-55f423ad995d" title="persistent_uid.mp4" controls></video> Kind regards, Cosmo.
Julio Cargnin Pereira added the
Type
Report
Severity
Normal
Status
Needs Triage
labels 2024-08-06 10:39:05 +02:00

UID is a hash, it can be just 0,1,2... enumeration, but this also can be int_max, so you should not depend on the value of this UID, but use this only as a hash.

UID is a hash, it can be just 0,1,2... enumeration, but this also can be int_max, so you should not depend on the value of this UID, but use this only as a hash.

UID is a hash, it can be just 0,1,2... enumeration, but this also can be int_max, so you should not depend on the value of this UID, but use this only as a hash.

Ok, so in other words these persistent_uid was not meant to store unique-random-integer-hash per modifier?

You're saying that we gonna have multiple same uids in different objects at the same time so... it dos not have the usability potential that I initially thought it would have?

> UID is a hash, it can be just 0,1,2... enumeration, but this also can be int_max, so you should not depend on the value of this UID, but use this only as a hash. Ok, so in other words these persistent_uid was not meant to store unique-random-integer-hash per modifier? You're saying that we gonna have multiple same uids in different objects at the same time so... it dos not have the usability potential that I initially thought it would have?

You're saying that we gonna have multiple same uids in different objects at the same time so

I do not see any duplication of the uid at the report, ony that they are doned in different way.

> You're saying that we gonna have multiple same uids in different objects at the same time so I do not see any duplication of the uid at the report, ony that they are doned in different way.

You're saying that we gonna have multiple same uids in different objects at the same time so

I do not see any duplication of the uid at the report, ony that they are doned in different way.

I've tried myself in 4.2 deleting the latest modifier and then adding it back. It is assigned with the same hash. (shouldn't be a different new integer?).

Also if you duplicate a existing object with modifiers, the hashes are going to remain the same in the other object.

I assumed Blender would assign unique ones when the duplication happens too, but I probably miss interpreting how this persistent_uid is created and what could be its usability.

I assumed this would be a random number per modifier but it seems this is not the case.

> > You're saying that we gonna have multiple same uids in different objects at the same time so > > I do not see any duplication of the uid at the report, ony that they are doned in different way. I've tried myself in 4.2 deleting the latest modifier and then adding it back. It is assigned with the same hash. (shouldn't be a different new integer?). Also if you duplicate a existing object with modifiers, the hashes are going to remain the same in the other object. I assumed Blender would assign unique ones when the duplication happens too, but I probably miss interpreting how this persistent_uid is created and what could be its usability. I assumed this would be a random number per modifier but it seems this is not the case.
Iliya Katushenock added the
Interest
Core
label 2024-08-06 19:13:36 +02:00
Member

I've tried myself in 4.2 deleting the latest modifier and then adding it back. It is assigned with the same hash. (shouldn't be a different new integer?).

Nope, it does not guarantee anything except that the number itself is unique in the list.

> I've tried myself in 4.2 deleting the latest modifier and then adding it back. It is assigned with the same hash. (shouldn't be a different new integer?). Nope, it does not guarantee anything except that the number itself is unique in the list.
Member

Hi, thanks for the report. Doesn't look like a bug. persistent_uid is introduced in 4.1. According to versioning code, if you open a older file with modifier in 4.1 and newer, persistent_uid of these modifiers will start from 1 then incremented by 1 for every next modifier on that object, see:

if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 20)) {
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
int uid = 1;
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
/* These identifiers are not necessarily stable for linked data. If the linked data has a
* new modifier inserted, the identifiers of other modifiers can change. */
md->persistent_uid = uid++;
}
}
}

Hi, thanks for the report. Doesn't look like a bug. `persistent_uid` is introduced in 4.1. According to versioning code, if you open a older file with modifier in 4.1 and newer, persistent_uid of these modifiers will start from 1 then incremented by 1 for every next modifier on that object, see: https://projects.blender.org/blender/blender/src/commit/7f7d85036f1ef93756e9021d65a2d657aceef20d/source/blender/blenloader/intern/versioning_400.cc#L3711-L3720
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2024-08-08 08:19:42 +02:00

Thank you for the clarifications, guys.
Best regards,
Cosmo.

Thank you for the clarifications, guys. Best regards, Cosmo.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#125952
No description provided.