Hi there,
After looking through basically every forum thread for a solution for accessing hidden selected objects from the outliner outside the outliner, I figured that it is not supported by the python API.
The bpy.context.selected_ids
works great, but for now at least only in the context of the Outliner, which is for most of the intended use cases not a good/feasible solution.
Long story short, I updated the awesome script of @iceythe to work with blender 2.93LTS.
This said, it is by nature a very “hacky” and I just did a quick rework and could not really test it, but here you go:
The internal struct have changed slightly, such that a few classes of the original script must be adjusted.
#unchanged
class SpaceOutliner(ctypes.Structure):
_fields_ = (
("next", ctypes.c_void_p),
("prev", ctypes.c_void_p),
("regionbase", ctypes.c_void_p * 2),
("spacetype", ctypes.c_char),
("link_flag", ctypes.c_char),
("pad0", ctypes.c_char * 6),
("v2d", ctypes.c_char * 160), #changed in 2.93 -> 160 (unsure if it's actually 160 xD)
("tree", listbase(TreeElement29)))
TreeElement._fields_ = (
("next", ctypes.POINTER(TreeElement)),
("prev", ctypes.POINTER(TreeElement)),
("_parent", ctypes.POINTER(TreeElement)),
("type", ctypes.c_void_p), #new field in 2.93
("subtree", listbase(TreeElement)),
("xys", ctypes.c_int * 2),
("_store_elem", ctypes.POINTER(TreeStoreElem)),
("flag", ctypes.c_short),
("index", ctypes.c_short),
("idcode", ctypes.c_short),
("xend", ctypes.c_short),
("_name", ctypes.c_char_p),
("directdata", ctypes.c_void_p),
("rnaptr", ctypes.c_void_p * 3)) #unchanged