Repository navigation
Description
Rust port: the scene item order, reorder and group membership decisions of libobs/obs-scene.c.h, moved to Rust (rust/obs-scene, new module item_order, next to item_names, group_transform and transform_update). Every drag in the source tree, every Move Up/Down/Top/Bottom, every group add or remove, and obs-websocket's item index go through them.
Unit
libobs/obs-scene.c.h → libobs/obs-scene-item-order.c.h → rust/obs-scene (item_order).
Phase and position
Phase 5/6 (core), the next slice of obs-scene.c.h in the core-source+ unity group, after the scene transform update decisions (#2874, merged).
Scope
Rust takes over these decisions, each asked where the C makes it today, from the values C reads at that point:
obs_sceneitem_set_order: which neighbour the item goes after (down: afterprev->prev, or the bottom; up: afternext, or afterprev; top: after the last item; bottom: the bottom);obs_sceneitem_set_order_position: the bottom for position 0 or an empty list, otherwise how far to walk from the first item (position - 1steps, stopped at the end of the list by C);obs_sceneitem_get_order_position: whether the item can be looked up;obs_scene_reorder_items: the per-item step ofsceneitems_match()(found in the order, and at its own index);obs_scene_reorder_items2: the check of the wanted (group, item) pairs against the current ones, and the group runs (which entries after a group entry go into it);move_active_child(): whether the active child moves (another scene, and the item is active);obs_sceneitem_group_add_item,obs_sceneitem_group_remove_itemandobs_sceneitem_group_ungroup2: their membership gates.
C keeps every full_lock/full_unlock, obs_scene_get_ref/release, detach_sceneitem/attach_sceneitem, every prev/next/first_item/parent write, every list walk, build_current_order_info(), move_would_recurse(), remove_group_transform()/apply_group_transform(), resize_group(), the hotkey moves, every signal and every log. Item and group pointers cross as opaque pointers that the core only compares; it never follows one.
Dependencies and existing tests
- No fix first. Depends on nothing open.
- Existing real-libobs coverage:
test_scene_list_remove,test_scene_enum_items_removal,test_group_recursion,test_group_child_drift,test_group_teardown_uaf,test_group_active_refs,test_group_empty_bounds,test_scene_canvas_characterizationandtest_scene_dup_group_children. - No characterization of the steps yet:
test_scene_item_order_stepslands first, on the moved file alone. It pins each movement at the bottom, in the middle, at the top and with one item; positions -1 (after the first item: characterized, not endorsed), 0, 1, the last index, the count and past it; the flat match with the same order, a permutation, a missing, an extra and a repeated item; the pair check and the group runs (sub-items that don't follow their group go to the top level: characterized, not endorsed); the active-child gate; and the add gate (its second check can't be reached: characterized, not endorsed).
Notes
Intentional differences (bug fixes found by reading, none reported by a user), fixed in the GREEN commit and listed in the parity test:
obs_scene_reorder_items2relinks whatever order it is given once it differs from the current one. An order that leaves out an item unlinks it while itsparentstill points at the scene, and an item from another scene or one listed twice is linked in as well. Fix: refuse the order unless its items are exactly the scene's current items (top level and in groups), each once. The flatobs_scene_reorder_itemsalready checks this.obs_sceneitem_set_orderwith a movement outsideenum obs_order_movementdetaches the item and never attaches it again. Fix: an unknown movement leaves the item where it was.obs_sceneitem_group_remove_itemdoesn't check that the item is in the group: a top-level item or one from another scene gets the group's transform removed and is moved into the group's parent scene. Fix: refuse unless the item's parent is the group's scene, asobs_sceneitem_group_add_itemchecks its side.obs_sceneitem_get_order_positionandobs_sceneitem_group_ungroup2readitem->parentbefore any check (and the getter locks a NULL scene for a detached item). Fix: a NULL or detached item gives 0 (the getter) or returns (ungroup2).
obs_scene_insert_group reading items[count - 1] with count 0 is left to its own fix; this unit doesn't touch that line. No user-visible change beyond the fixes above, no exported symbol changes; the new functions are hidden.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 29, 2026
Claiming: #2895 (round 14 unit 1).
libobs/obs-scene-item-order.c.h(behaviour-neutral, still inlibobs.core-source).test_scene_item_order_steps.todo!()stubs.libobs.ported-scene-item-order, with the four fixes in the issue as intentional differences.One PR; a draft opens with the RED commit today. No open PR touches these functions or the
core-source+group.libobs: Move the scene item order rules
test: Characterize the scene item order rules
obs-scene: Test the scene item order rules
obs-scene: Port the scene item order rules
obs-scene: Compare scene item order rules with C
docs: Describe the scene item order port
libobs: Ask the scene item order steps in place
obs-scene: Answer the scene item order steps
docs: Describe the in-place scene item order steps
obs-scene: Take the active count as a C long
docs: Update the scene item order bench numbers
rdoupe commentedon Oct 29, 2026
Fixed by the PR that ports the scene item order rules (#2899), merged through the queue.
What it did: the order, reorder and group membership decisions now live in
rust/obs-scene(item_order), with C keeping the locks, walks and link writes. The four intentional fixes listed here are in, each asserted by the parity test.What is left, deliberately still C:
obs_scene_insert_group()'s item gate andobs_scene_get_group()'s name match (each is a single compare, with no decision of its own to port), andobs_scene_insert_group()'sitems[count - 1]read whencountis 0, which this unit does not touch.Follow-up issue: none filed yet for the
items[count - 1]read; it needs its own fix issue.docs: Add the empty group insert to the ledger
obs-scene: Port the scene item order rules (obs-rust#2899)
libobs: Add an empty group on top for count 0 (obs-rust#2949)
obs-scene: port obs_sceneitem_set_order to Rust (Fixes obs-rust#5787) (…
test: characterize obs_scene_reorder_items2 (Refs #6064)
obs-scene: port obs_scene_reorder_items2 to Rust (Fixes obs-rust#6064) (