Page MenuHome

Fix T94299: Object asset set as visible but doesn't show
ClosedPublic

Authored by Julian Eisel (Severin) on Jan 5 2022, 1:34 PM.

Details

Summary

After hiding an object (screen icon) that is an asset, dragging it into the viewport from the Asset Browser to create a duplicate would attempt to unhide it. However the unhiding wouldn't be evaluated/synced properly, so it was still hidden in the viewport. The Outliner would show it as visible.

There was also a failed assert:

BLI_assert failed: source/blender/editors/object/object_add.c:2168, copy_object_set_idnew(), at '(id_iter->tag & LIB_TAG_NEW) == 0'

That is because copy_object_set_idnew() depends on the properly synced/evaluated visibility for both the selected_editable_objects iterator, and the new-ID relinking. The latter eventually calls BKE_main_collection_sync_remap() which syncs the visibility flags, but only after the fact.

Diff Detail

Repository
rB Blender

Event Timeline

Julian Eisel (Severin) requested review of this revision.Jan 5 2022, 1:34 PM
Julian Eisel (Severin) created this revision.
source/blender/editors/object/object_add.c
3531

We don't usually call this function directly. Could call BKE_main_collection_sync_remap() here, but that doesn't seem cheap, and it is called eventually anyway (through copy_object_set_idnew() -> BKE_libblock_relink_to_newid().
So I think this is the best solution.

Not sure i understand the issue here, afaik duplicate_exec works fine, or does it also expose that issue?

duplicate_exec doesn't unhide objects, it only operates on already visible objects (uses the BASE_SELECTED() macro). It's only exposed in the 3D Viewport, so that makes sense, although I see you can execute it in the Outliner using operator search. Not sure how it should behave then, maybe it should unhide too.

For dragging objects into the 3D viewport I think it makes sense to force-unhide them.

Ah OK, makes sense now...

Then yes, this looks to be the best solution indeed... Would not mind having @Sergey Sharybin (sergey) check on it too though.

As long as the viewport visibility is not animatable/drivable this should be fine. Maybe add a note about it in the comment.

This revision is now accepted and ready to land.Jan 10 2022, 4:51 PM