feat(web): Outliner Data menu exposes the collection visibility operators

Desktop OUTLINER_MT_collection_visibility's entries now run the native
isolate/show/hide, show-all-inside/hide-all-inside and enable/disable
viewport/render collection operators on the selected collections, with the
state-dependent entries gated the way their desktop polls gate them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-01 05:55:09 +08:00
parent 1e2f206f2e
commit 21f3efbf90
12 changed files with 92 additions and 14 deletions

View File

@@ -1180,4 +1180,45 @@ test.describe("Outliner headed baseline", () => {
await expect(payloadRow.first()).toBeVisible({ timeout: 30_000 });
await expect(payloadRow.first()).toHaveAttribute("data-selected", "true");
});
test("[outliner-collection-visibility-web] the Data menu runs the collection visibility operators", async ({ page }) => {
test.setTimeout(180_000);
await page.goto("/?ui=web");
const status = page.locator('[data-testid="engine-status"]');
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 eye = (prefix: string, name: string) => page.locator(`.outliner-tree button[aria-label="${prefix} ${name}"]`);
const archiveRow = page.locator('.tree-row[aria-label="Archive"]').first();
const partsRow = page.locator('.tree-row[aria-label="Parts"]').first();
await expect(archiveRow).toBeVisible({ timeout: 30_000 });
await expect(eye("隐藏", "Archive")).toHaveCount(1);
const visibility = async (row: typeof archiveRow, label: string) => {
await row.locator(".tree-node-name").first().click({ button: "right" });
await page.getByRole("menuitem", { name: "可见性 (Visibility)", exact: true }).click();
await page.getByRole("menuitem", { name: label, exact: true }).click();
};
/* OUTLINER_OT_collection_hide/show -> collection_visibility_exec writes
* LayerCollection.flag LAYER_COLLECTION_HIDE on the selected collection. */
await visibility(archiveRow, "隐藏 (Hide)");
await expect.poll(async () => eye("显示", "Archive").count(), { timeout: 30_000 }).toBe(1);
await visibility(archiveRow, "显示 (Show)");
await expect.poll(async () => eye("隐藏", "Archive").count(), { timeout: 30_000 }).toBe(1);
/* Show/Hide All Inside recurse through BKE_layer_collection_set_visible
* (hierarchy=true), hiding the collection's object bases too. */
await visibility(partsRow, "隐藏内部 (Hide All Inside)");
await expect.poll(async () => eye("显示", "Mount").count(), { timeout: 30_000 }).toBeGreaterThan(0);
await visibility(partsRow, "显示内部 (Show All Inside)");
await expect.poll(async () => eye("显示", "Mount").count(), { timeout: 30_000 }).toBe(0);
/* OUTLINER_OT_collection_isolate hides every collection outside the
* selected one (outliner_collection_isolate_flag). */
await visibility(archiveRow, "隔离 (Isolate)");
await expect.poll(async () => eye("显示", "Parts").count(), { timeout: 30_000 }).toBe(1);
});
});