Remap Users operator doesn't work on Objects #108285

Closed
opened 2023-05-25 18:20:18 +02:00 by Demeter Dzadik · 5 comments
Member

Blender Version
Broken: version: 4.0.0 Alpha, branch: HEAD (modified), commit date: 2023-05-25 12:53, hash: de2c8416a038

Short description of error
The Remap Users operator doesn't seem to work on Objects.

I'd also like to take this opportunity for a teeny tiny request: Could the operator use a text-based search among the available options, instead of a regular enum drop-down?

Exact steps for others to reproduce the error

  1. Right click any Object.
  2. ID Data-> Remap Users.
  3. Nothing happens.
**Blender Version** Broken: version: 4.0.0 Alpha, branch: HEAD (modified), commit date: 2023-05-25 12:53, hash: `de2c8416a038` **Short description of error** The Remap Users operator doesn't seem to work on Objects. I'd also like to take this opportunity for a teeny tiny request: Could the operator use a text-based search among the available options, instead of a regular enum drop-down? **Exact steps for others to reproduce the error** 1. Right click any Object. 2. ID Data-> Remap Users. 3. Nothing happens.
Demeter Dzadik added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-05-25 18:20:19 +02:00
Bastien Montagne added the
Module
Core
label 2023-05-25 18:31:22 +02:00

@Mets This could be correct behavior if nothing is using such object. Remap users feature will replace all occurences of ID you clicked on by another ID. So for example you can batch replace materials.

The tooltip seems quite confusing and I see no other official documentation about this, so not sure if you jst aren't sure how this feature works, or you still think if this is a bug.

@Mets This could be correct behavior if nothing is using such object. Remap users feature will replace all occurences of ID you clicked on by another ID. So for example you can batch replace materials. The tooltip seems quite confusing and I see no other official documentation about this, so not sure if you jst aren't sure how this feature works, or you still think if this is a bug.
Richard Antalik added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-05-26 05:13:26 +02:00
Author
Member

I would expect the button to behave the same as the call 'ID.user_remap(other_ID)'

Which, for an object that is linked to a scene, will always do something, and result in it not being linked to that scene anymore, since the reference from all collections to the object is replaced with the other object.

Another way to look at it is that whatever ID the function is called on should end up with 0 users, aka becoming Orphan Data, only getting saved if it has the fake user flag turned on.

If by some miracle I am really misunderstanding something and the operator's early exit is intended, it should show a message explaining why the operation was cancelled, like every other operator in Blender. But as a bonus, it could also show message when it succeeds, like every well implemented operator in Blender! :3

But to answer the question, yes, I still think it's a bug. Maybe @mont29 can confirm?

I would expect the button to behave the same as the call 'ID.user_remap(other_ID)' Which, for an object that is linked to a scene, will always do something, and result in it not being linked to that scene anymore, since the reference from all collections to the object is replaced with the other object. Another way to look at it is that whatever ID the function is called on should end up with 0 users, aka becoming Orphan Data, only getting saved if it has the fake user flag turned on. If by some miracle I am really misunderstanding something and the operator's early exit is intended, it should show a message explaining why the operation was cancelled, like every other operator in Blender. But as a bonus, it could also show message when it succeeds, like every well implemented operator in Blender! :3 But to answer the question, yes, I still think it's a bug. Maybe @mont29 can confirm?

Thanks for clarification.

Thanks for clarification.
Richard Antalik added
Status
Needs Triage
and removed
Status
Needs Information from User
labels 2023-05-26 07:29:20 +02:00
Member

@mont29 : Outliner code is pretty specific about this (not allowing objects) wheres the RNA function does not have this restriction. The whole thing came with 7547c6a250. Do you recall why you made this different?

Seems this was already considered for removal (see 30534deced and 8c9805fc62)

In addition, it seems quite easy to break this using it on objects @Mets ?
If I do this:

cube = D.objects['Cube']
light = D.objects['Light']
cube.user_remap(light)

then select something afterwards, I get a crash:

READ of size 2 at 0x60600010546c thread T0
    #0 0xb01b67b in outliner_select_sync_from_object /blender/source/blender/editors/space_outliner/outliner_sync.cc:406
    #1 0xb01ca42 in outliner_sync_selection_to_outliner /blender/source/blender/editors/space_outliner/outliner_sync.cc:509
    #2 0xb01cf9b in outliner_sync_selection_to_outliner /blender/source/blender/editors/space_outliner/outliner_sync.cc:532
    #3 0xb01cf9b in outliner_sync_selection_to_outliner /blender/source/blender/editors/space_outliner/outliner_sync.cc:532
    #4 0xb01d398 in blender::ed::outliner::outliner_sync_selection(bContext const*, SpaceOutliner*) /blender/source/blender/editors/space_outliner/outliner_sync.cc:564
    #5 0xafff32e in blender::ed::outliner::draw_outliner(bContext const*) /blender/source/blender/editors/space_outliner/outliner_draw.cc:3887
    #6 0xb06fb1f in outliner_main_region_draw /blender/source/blender/editors/space_outliner/space_outliner.cc:86
    #7 0x6685a44 in ED_region_do_draw /blender/source/blender/editors/screen/area.cc:537
    #8 0x3b0d880 in wm_draw_window_offscreen /blender/source/blender/windowmanager/intern/wm_draw.c:964
    #9 0x3b0ef35 in wm_draw_window /blender/source/blender/windowmanager/intern/wm_draw.c:1129
    #10 0x3b11f02 in wm_draw_update /blender/source/blender/windowmanager/intern/wm_draw.c:1513
    #11 0x3af6eea in WM_main /blender/source/blender/windowmanager/intern/wm.c:652
    #12 0x8d9ba6 in main /blender/source/creator/creator.c:583
    #13 0x7fffee04a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
    #14 0x7fffee04a5c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c8)
    #15 0x8d8d84 in _start (/build_linux_debug/bin/blender+0x8d8d84)

0x60600010546c is located 44 bytes inside of 56-byte region [0x606000105440,0x606000105478)
freed by thread T0 here:
    #0 0x7ffff78b9388 in __interceptor_free.part.0 (/lib64/libasan.so.8+0xb9388)
    #1 0x1e628622 in MEM_lockfree_freeN /blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:102
    #2 0x1e0ce063 in BLI_freelinkN /blender/source/blender/blenlib/intern/listbase.cc:277
    #3 0xd5b0bb in view_layer_bases_hash_create /blender/source/blender/blenkernel/intern/layer.cc:372
    #4 0xd66c86 in BKE_main_collection_sync_remap /blender/source/blender/blenkernel/intern/layer.cc:1462
    #5 0xdf91e5 in libblock_remap_data_postprocess_object_update /blender/source/blender/blenkernel/intern/lib_remap.c:352
    #6 0xdfae3c in libblock_remap_foreach_idpair_cb /blender/source/blender/blenkernel/intern/lib_remap.c:601
    #7 0xd93d24 in blender::bke::id::remapper::IDRemapper::iter(void (*)(ID*, ID*, void*), void*) const /blender/source/blender/blenkernel/intern/lib_id_remapper.cc:112
    #8 0xd9235a in BKE_id_remapper_iter /blender/source/blender/blenkernel/intern/lib_id_remapper.cc:219
    #9 0xdfb126 in BKE_libblock_remap_multiple_locked /blender/source/blender/blenkernel/intern/lib_remap.c:653
    #10 0xdfb244 in BKE_libblock_remap_locked /blender/source/blender/blenkernel/intern/lib_remap.c:688
    #11 0xdfb2b9 in BKE_libblock_remap /blender/source/blender/blenkernel/intern/lib_remap.c:696
    #12 0x5a26c37 in rna_ID_user_remap /blender/source/blender/makesrna/intern/rna_ID.c:1014
    #13 0x5a356e7 in ID_user_remap_call /build_linux_debug/source/blender/makesrna/intern/rna_ID_gen.c:1651
    #14 0x5a057bb in RNA_function_call /blender/source/blender/makesrna/intern/rna_access.cc:6335
    #15 0x65e0f90 in pyrna_func_call /blender/source/blender/python/intern/bpy_rna.c:6499
    #16 0x83162a in _PyObject_MakeTpCall Objects/call.c:215

previously allocated by thread T0 here:
    #0 0x7ffff78ba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af)
    #1 0x1e628fbc in MEM_lockfree_mallocN /blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:247
    #2 0x3d47365 in read_struct /blender/source/blender/blenloader/intern/readfile.cc:1770
    #3 0x3d54027 in read_data_into_datamap /blender/source/blender/blenloader/intern/readfile.cc:2973
    #4 0x3d587ac in read_libblock /blender/source/blender/blenloader/intern/readfile.cc:3344
    #5 0x3d60e82 in blo_read_file_internal /blender/source/blender/blenloader/intern/readfile.cc:3895
    #6 0x3d330f5 in BLO_read_from_file /blender/source/blender/blenloader/intern/readblenentry.cc:413
    #7 0x8f8822 in BKE_blendfile_read /blender/source/blender/blenkernel/intern/blendfile.cc:589
    #8 0x3b6e899 in wm_homefile_read_ex /blender/source/blender/windowmanager/intern/wm_files.cc:1332
    #9 0x3b9063f in WM_init /blender/source/blender/windowmanager/intern/wm_init_exit.cc:300
    #10 0x8d9a96 in main /blender/source/creator/creator.c:527
    #11 0x7fffee04a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

SUMMARY: AddressSanitizer: heap-use-after-free /blender/source/blender/editors/space_outliner/outliner_sync.cc:406 in outliner_select_sync_from_object
Shadow bytes around the buggy address:
  0x0c0c80018a30: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
  0x0c0c80018a40: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd
  0x0c0c80018a50: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c80018a60: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa
  0x0c0c80018a70: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00
=>0x0c0c80018a80: 00 00 00 fa fa fa fa fa fd fd fd fd fd[fd]fd fa
  0x0c0c80018a90: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa
  0x0c0c80018aa0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00
  0x0c0c80018ab0: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa
  0x0c0c80018ac0: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa
  0x0c0c80018ad0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==1158759==ABORTING

So, @mont29 :

  • is the operation considered safe with objects?
    -- then we should expose it in the outliner as well? (remove the if (idlevel > 0) check in outliner_id_operation_exec)
    -- we should also look into the crash mentioned above
  • is it not considered safe?
    -- prevent the RNA func to act on objects also
@mont29 : Outliner code is pretty specific about this (not allowing objects) wheres the RNA function does not have this restriction. The whole thing came with 7547c6a250cd. Do you recall why you made this different? Seems this was already considered for removal (see 30534deced8dad16c566dd82db3edd462283de13 and 8c9805fc6282) In addition, it seems quite easy to break this using it on objects @Mets ? If I do this: ``` cube = D.objects['Cube'] light = D.objects['Light'] cube.user_remap(light) ``` then select something afterwards, I get a crash: ``` READ of size 2 at 0x60600010546c thread T0 #0 0xb01b67b in outliner_select_sync_from_object /blender/source/blender/editors/space_outliner/outliner_sync.cc:406 #1 0xb01ca42 in outliner_sync_selection_to_outliner /blender/source/blender/editors/space_outliner/outliner_sync.cc:509 #2 0xb01cf9b in outliner_sync_selection_to_outliner /blender/source/blender/editors/space_outliner/outliner_sync.cc:532 #3 0xb01cf9b in outliner_sync_selection_to_outliner /blender/source/blender/editors/space_outliner/outliner_sync.cc:532 #4 0xb01d398 in blender::ed::outliner::outliner_sync_selection(bContext const*, SpaceOutliner*) /blender/source/blender/editors/space_outliner/outliner_sync.cc:564 #5 0xafff32e in blender::ed::outliner::draw_outliner(bContext const*) /blender/source/blender/editors/space_outliner/outliner_draw.cc:3887 #6 0xb06fb1f in outliner_main_region_draw /blender/source/blender/editors/space_outliner/space_outliner.cc:86 #7 0x6685a44 in ED_region_do_draw /blender/source/blender/editors/screen/area.cc:537 #8 0x3b0d880 in wm_draw_window_offscreen /blender/source/blender/windowmanager/intern/wm_draw.c:964 #9 0x3b0ef35 in wm_draw_window /blender/source/blender/windowmanager/intern/wm_draw.c:1129 #10 0x3b11f02 in wm_draw_update /blender/source/blender/windowmanager/intern/wm_draw.c:1513 #11 0x3af6eea in WM_main /blender/source/blender/windowmanager/intern/wm.c:652 #12 0x8d9ba6 in main /blender/source/creator/creator.c:583 #13 0x7fffee04a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) #14 0x7fffee04a5c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c8) #15 0x8d8d84 in _start (/build_linux_debug/bin/blender+0x8d8d84) 0x60600010546c is located 44 bytes inside of 56-byte region [0x606000105440,0x606000105478) freed by thread T0 here: #0 0x7ffff78b9388 in __interceptor_free.part.0 (/lib64/libasan.so.8+0xb9388) #1 0x1e628622 in MEM_lockfree_freeN /blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:102 #2 0x1e0ce063 in BLI_freelinkN /blender/source/blender/blenlib/intern/listbase.cc:277 #3 0xd5b0bb in view_layer_bases_hash_create /blender/source/blender/blenkernel/intern/layer.cc:372 #4 0xd66c86 in BKE_main_collection_sync_remap /blender/source/blender/blenkernel/intern/layer.cc:1462 #5 0xdf91e5 in libblock_remap_data_postprocess_object_update /blender/source/blender/blenkernel/intern/lib_remap.c:352 #6 0xdfae3c in libblock_remap_foreach_idpair_cb /blender/source/blender/blenkernel/intern/lib_remap.c:601 #7 0xd93d24 in blender::bke::id::remapper::IDRemapper::iter(void (*)(ID*, ID*, void*), void*) const /blender/source/blender/blenkernel/intern/lib_id_remapper.cc:112 #8 0xd9235a in BKE_id_remapper_iter /blender/source/blender/blenkernel/intern/lib_id_remapper.cc:219 #9 0xdfb126 in BKE_libblock_remap_multiple_locked /blender/source/blender/blenkernel/intern/lib_remap.c:653 #10 0xdfb244 in BKE_libblock_remap_locked /blender/source/blender/blenkernel/intern/lib_remap.c:688 #11 0xdfb2b9 in BKE_libblock_remap /blender/source/blender/blenkernel/intern/lib_remap.c:696 #12 0x5a26c37 in rna_ID_user_remap /blender/source/blender/makesrna/intern/rna_ID.c:1014 #13 0x5a356e7 in ID_user_remap_call /build_linux_debug/source/blender/makesrna/intern/rna_ID_gen.c:1651 #14 0x5a057bb in RNA_function_call /blender/source/blender/makesrna/intern/rna_access.cc:6335 #15 0x65e0f90 in pyrna_func_call /blender/source/blender/python/intern/bpy_rna.c:6499 #16 0x83162a in _PyObject_MakeTpCall Objects/call.c:215 previously allocated by thread T0 here: #0 0x7ffff78ba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af) #1 0x1e628fbc in MEM_lockfree_mallocN /blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:247 #2 0x3d47365 in read_struct /blender/source/blender/blenloader/intern/readfile.cc:1770 #3 0x3d54027 in read_data_into_datamap /blender/source/blender/blenloader/intern/readfile.cc:2973 #4 0x3d587ac in read_libblock /blender/source/blender/blenloader/intern/readfile.cc:3344 #5 0x3d60e82 in blo_read_file_internal /blender/source/blender/blenloader/intern/readfile.cc:3895 #6 0x3d330f5 in BLO_read_from_file /blender/source/blender/blenloader/intern/readblenentry.cc:413 #7 0x8f8822 in BKE_blendfile_read /blender/source/blender/blenkernel/intern/blendfile.cc:589 #8 0x3b6e899 in wm_homefile_read_ex /blender/source/blender/windowmanager/intern/wm_files.cc:1332 #9 0x3b9063f in WM_init /blender/source/blender/windowmanager/intern/wm_init_exit.cc:300 #10 0x8d9a96 in main /blender/source/creator/creator.c:527 #11 0x7fffee04a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) SUMMARY: AddressSanitizer: heap-use-after-free /blender/source/blender/editors/space_outliner/outliner_sync.cc:406 in outliner_select_sync_from_object Shadow bytes around the buggy address: 0x0c0c80018a30: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa 0x0c0c80018a40: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd 0x0c0c80018a50: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fa 0x0c0c80018a60: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c80018a70: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 =>0x0c0c80018a80: 00 00 00 fa fa fa fa fa fd fd fd fd fd[fd]fd fa 0x0c0c80018a90: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c80018aa0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c80018ab0: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c80018ac0: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c80018ad0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==1158759==ABORTING ``` So, @mont29 : - is the operation considered safe with objects? -- then we should expose it in the outliner as well? (remove the `if (idlevel > 0)` check in `outliner_id_operation_exec`) -- we should also look into the crash mentioned above - is it **not** considered safe? -- prevent the RNA func to act on objects also
Philipp Oeser added
Status
Needs Info from Developers
and removed
Status
Needs Triage
labels 2023-05-26 09:41:34 +02:00

This is essentially a mix of horrible Outliner handling of its tools, and legacy stuff that got moved around without being properly updated (Objects used to have their own remap operation, code is still even there, just not hooked anywhere anymore afaict).

Will check the crash, remapping objects is expected to work as anything else. ;)

This is essentially a mix of horrible Outliner handling of its tools, and legacy stuff that got moved around without being properly updated (Objects used to have their own remap operation, code is still even there, just not hooked anywhere anymore afaict). Will check the crash, remapping objects is expected to work as anything else. ;)
Blender Bot added
Status
Resolved
and removed
Status
Needs Info from Developers
labels 2023-06-02 15:26:45 +02: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
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#108285
No description provided.