feat(web): Outliner filter popover exposes the Collections and Objects toggles

The engine already maps showCollections/showObjects onto SO_FILTER_NO_COLLECTION
and SO_FILTER_NO_OBJECT (OUTLINER_SET_FILTER); the popover now renders both
checkboxes, and the Data menu hides Unlink in View Layer mode while the
Collections filter is off, matching space_outliner.py. The filter case counts
the two new toggles.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-01 09:37:53 +08:00
parent 25dccb1dc6
commit 32af2a256d
4 changed files with 53 additions and 4 deletions

View File

@@ -183,8 +183,11 @@ test.describe("Outliner headed baseline", () => {
const menu = page.locator(".outliner-filter-menu").first();
await expect(menu).toBeVisible();
const checkboxes = menu.locator('input[type="checkbox"]');
/* Four filter-state toggles plus the seven View Layer restriction toggles. */
await expect(checkboxes).toHaveCount(11);
/* Six filter toggles (visible / selected / collections / objects / invert /
* sync) plus the seven View Layer restriction toggles. */
await expect(checkboxes).toHaveCount(13);
await expect(menu.getByLabel("集合")).toHaveCount(1);
await expect(menu.getByLabel("物体")).toHaveCount(1);
await expect(menu.getByLabel("反转")).toHaveCount(1);
await expect(menu.getByLabel("同步选择")).toHaveCount(1);
await filterButton.click();
@@ -1407,4 +1410,47 @@ test.describe("Outliner headed baseline", () => {
await expect(page.getByRole("menuitem", { name: "可见性 (Visibility)", exact: true })).toHaveCount(1, { timeout: 15_000 });
await expect(viewLayerItem).toHaveCount(0);
});
test("[outliner-filter-collection-toggle-web] the filter hides collections and gates Unlink", async ({ page }) => {
test.setTimeout(180_000);
await page.goto("/?ui=web");
await page.locator('[data-testid="blend-file-input"]').setInputFiles(HIERARCHY_SCENE);
await expect(page.locator(".blender-app")).toHaveAttribute("data-project-id", /.+/, { timeout: 60_000 });
await expect(page.getByText(/Engine: SceneIR/).first()).toBeVisible({ timeout: 60_000 });
const webTools = page.locator('[data-testid="native-web-tools-toggle"]');
if (await webTools.count()) await webTools.click();
const partsRow = page.locator('.tree-row[aria-label="Parts"]').first();
await expect(partsRow).toBeVisible({ timeout: 30_000 });
/* Desktop default (use_filter_collection on) keeps Unlink in the menu. */
await partsRow.locator(".tree-node-name").first().click({ button: "right" });
await expect(page.getByRole("menuitem", { name: "取消链接", exact: true })).toHaveCount(1, { timeout: 15_000 });
await page.keyboard.press("Escape");
/* Unchecking Collections sets SO_FILTER_NO_COLLECTION; the view-layer tree
* then stops emitting collection rows (tree_display_view_layer.cc). */
const filterButton = page.locator('button[aria-label="筛选"]').first();
await filterButton.click();
const menu = page.locator(".outliner-filter-menu").first();
await expect(menu).toBeVisible();
await menu.getByLabel("集合").uncheck();
await filterButton.click();
await expect.poll(async () => page.locator('.tree-row[aria-label="Parts"]').count(), { timeout: 30_000 }).toBe(0);
/* space_outliner.py hides Unlink when display_mode == 'VIEW_LAYER' and
* use_filter_collection is off. */
const rootRig = page.locator('.tree-row[aria-label="RootRig"]').first();
await expect(rootRig).toBeVisible({ timeout: 15_000 });
await rootRig.locator(".tree-node-name").first().click({ button: "right" });
await expect(page.getByRole("menuitem", { name: "取消链接", exact: true })).toHaveCount(0, { timeout: 15_000 });
await page.keyboard.press("Escape");
/* Re-enabling collections restores the rows and the menu entry. */
await filterButton.click();
await menu.getByLabel("集合").check();
await filterButton.click();
await expect.poll(async () => page.locator('.tree-row[aria-label="Parts"]').count(), { timeout: 30_000 }).toBeGreaterThan(0);
await page.locator('.tree-row[aria-label="Parts"]').first().locator(".tree-node-name").first().click({ button: "right" });
await expect(page.getByRole("menuitem", { name: "取消链接", exact: true })).toHaveCount(1, { timeout: 15_000 });
});
});