Duplicating objects with custom property of type ID creates bogus links #70787

Closed
opened 2019-10-13 15:25:46 +02:00 by Stanislav Blinov · 5 comments

Blender Version
blender-2.81-95f020c853d6

When object A refers to object B via a custom property, duplicating A creates extra links on B.

Create a new scene with two objects, select the objects.
Run this in Python console:
bpy.types.Object.custom_reference = bpy.props.PointerProperty(type=bpy.types.Object, name="Test")
bpy.context.selected_objects- [x].custom_reference = bpy.context.selected_objects[1]

Now you should see one of the objects having 2 (two) links in its datablock, as it should, and Custom Properties of the other should show the property.
Duplicate the referring object and check the other one. It will now have 4 (four) links, instead of 3. Delete the duplicate. The number of links will go down to 3 (three). Delete the last one with the custom property. Number of links will be 2.

Recreate the scene as above and duplicate the referring object. The target should again have the (incorrect) four links. Select all three objects and duplicate them. In that new trio, the copy of target will have a correct number of links (three). But the number of links on the original goes up to 6.

**Blender Version** blender-2.81-95f020c853d6 When object A refers to object B via a custom property, duplicating A creates extra links on B. Create a new scene with two objects, select the objects. Run this in Python console: bpy.types.Object.custom_reference = bpy.props.PointerProperty(type=bpy.types.Object, name="Test") bpy.context.selected_objects- [x].custom_reference = bpy.context.selected_objects[1] Now you should see one of the objects having 2 (two) links in its datablock, as it should, and Custom Properties of the other should show the property. Duplicate the referring object and check the other one. It will now have 4 (four) links, instead of 3. Delete the duplicate. The number of links will go down to 3 (three). Delete the last one with the custom property. Number of links will be 2. Recreate the scene as above and duplicate the referring object. The target should again have the (incorrect) four links. Select all three objects and duplicate them. In that new trio, the copy of target will have a correct number of links (three). But the number of links on the original goes up to 6.

Added subscriber: @Stan_Pancakes

Added subscriber: @Stan_Pancakes
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Bastien Montagne was assigned by Jacques Lucke 2019-10-14 09:58:42 +02:00
Member

Can confirm the issue. The user count is incremented twice.

id_us_plus(ID * id) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:246)
IDP_CopyID(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:458)
IDP_CopyProperty_ex(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:762)
IDP_CopyGroup(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:485)
IDP_CopyProperty_ex(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:758)
BKE_libblock_copy_ex(Main * bmain, const ID * id, ID ** r_newid, const int orig_flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:1472)
BKE_id_copy_ex(Main * bmain, const ID * id, ID ** r_newid, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:663)
BKE_id_copy(Main * bmain, const ID * id, ID ** newid) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:797)
BKE_object_copy(Main * bmain, const Object * ob) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1408)
BKE_object_duplicate(Main * bmain, const Object * ob, const int dupflag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1431)
id_us_plus(ID * id) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:246)
id_copy_libmanagement_cb(void * user_data, ID * UNUSED_id_self, ID ** id_pointer, int cb_flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:606)
library_foreach_idproperty_ID_link(LibraryForeachIDData * data, IDProperty * prop, int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:183)
library_foreach_idproperty_ID_link(LibraryForeachIDData * data, IDProperty * prop, int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:171)
library_foreach_ID_link(Main * bmain, ID * id, LibraryIDLinkCallback callback, void * user_data, int flag, LibraryForeachIDData * inherit_data) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:438)
BKE_library_foreach_ID_link(Main * bmain, ID * id, LibraryIDLinkCallback callback, void * user_data, int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:1082)
BKE_id_copy_ex(Main * bmain, const ID * id, ID ** r_newid, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:776)
BKE_id_copy(Main * bmain, const ID * id, ID ** newid) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:797)
BKE_object_copy(Main * bmain, const Object * ob) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1408)
BKE_object_duplicate(Main * bmain, const Object * ob, const int dupflag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1431)
  1. Open the file.
  2. Make sure you see the user count of the objects in the outliner.
  3. Duplicate the selected object.
    id_property.blend
Can confirm the issue. The user count is incremented twice. ``` id_us_plus(ID * id) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:246) IDP_CopyID(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:458) IDP_CopyProperty_ex(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:762) IDP_CopyGroup(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:485) IDP_CopyProperty_ex(const IDProperty * prop, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/idprop.c:758) BKE_libblock_copy_ex(Main * bmain, const ID * id, ID ** r_newid, const int orig_flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:1472) BKE_id_copy_ex(Main * bmain, const ID * id, ID ** r_newid, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:663) BKE_id_copy(Main * bmain, const ID * id, ID ** newid) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:797) BKE_object_copy(Main * bmain, const Object * ob) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1408) BKE_object_duplicate(Main * bmain, const Object * ob, const int dupflag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1431) ``` ``` id_us_plus(ID * id) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:246) id_copy_libmanagement_cb(void * user_data, ID * UNUSED_id_self, ID ** id_pointer, int cb_flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:606) library_foreach_idproperty_ID_link(LibraryForeachIDData * data, IDProperty * prop, int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:183) library_foreach_idproperty_ID_link(LibraryForeachIDData * data, IDProperty * prop, int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:171) library_foreach_ID_link(Main * bmain, ID * id, LibraryIDLinkCallback callback, void * user_data, int flag, LibraryForeachIDData * inherit_data) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:438) BKE_library_foreach_ID_link(Main * bmain, ID * id, LibraryIDLinkCallback callback, void * user_data, int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library_query.c:1082) BKE_id_copy_ex(Main * bmain, const ID * id, ID ** r_newid, const int flag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:776) BKE_id_copy(Main * bmain, const ID * id, ID ** newid) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/library.c:797) BKE_object_copy(Main * bmain, const Object * ob) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1408) BKE_object_duplicate(Main * bmain, const Object * ob, const int dupflag) (/home/jacques/blender-git/blender/source/blender/blenkernel/intern/object.c:1431) ``` 1. Open the file. 2. Make sure you see the user count of the objects in the outliner. 3. Duplicate the selected object. [id_property.blend](https://archive.blender.org/developer/F7815851/id_property.blend)

This issue was referenced by 0fb55ff845

This issue was referenced by 0fb55ff845fcaa76d9b540c2fbdd3e1b4671a7e7

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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#70787
No description provided.