-
Notifications
You must be signed in to change notification settings - Fork 673
fix: hide linked core media inputs in Nodes 2.0 #14981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jaeone94
wants to merge
10
commits into
main
Choose a base branch
from
jaeone94/linked-core-media
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9756b32
fix: hide linked core media inputs
jaeone94 4f30161
refactor: simplify linked media menu dependencies
jaeone94 c83dc01
fix: refit linked core media nodes
jaeone94 ad4446a
test: verify linked audio controls restore
jaeone94 f77f6ee
test: select nodes before media menu checks
jaeone94 5851056
fix: address linked media review feedback
jaeone94 05a6343
fix: preserve linked media node sizes
jaeone94 aa57da4
fix: support linked core image loader variants
jaeone94 00b0aaf
fix: harden linked media preview detection
jaeone94 9e66a1b
chore: merge main into linked media changes
jaeone94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| { | ||
| "id": "6db64321-d1c9-4bb5-b6d4-e08b60531fc6", | ||
| "revision": 0, | ||
| "last_node_id": 6, | ||
| "last_link_id": 3, | ||
| "nodes": [ | ||
| { | ||
| "id": 1, | ||
| "type": "PrimitiveNode", | ||
| "pos": [20, 20], | ||
| "size": [250, 82], | ||
| "flags": {}, | ||
| "order": 0, | ||
| "mode": 0, | ||
| "inputs": [], | ||
| "outputs": [ | ||
| { | ||
| "name": "COMBO", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "image" | ||
| }, | ||
| "links": [1] | ||
| } | ||
| ], | ||
| "title": "image", | ||
| "properties": { | ||
| "Run widget replace on values": false | ||
| }, | ||
| "widgets_values": ["linked-image.webp", "fixed"] | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "type": "PrimitiveNode", | ||
| "pos": [20, 380], | ||
| "size": [250, 82], | ||
| "flags": {}, | ||
| "order": 1, | ||
| "mode": 0, | ||
| "inputs": [], | ||
| "outputs": [ | ||
| { | ||
| "name": "COMBO", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "file" | ||
| }, | ||
| "links": [2] | ||
| } | ||
| ], | ||
| "title": "file", | ||
| "properties": { | ||
| "Run widget replace on values": false | ||
| }, | ||
| "widgets_values": ["linked-video.mp4", "fixed"] | ||
| }, | ||
| { | ||
| "id": 3, | ||
| "type": "PrimitiveNode", | ||
| "pos": [20, 740], | ||
| "size": [250, 82], | ||
| "flags": {}, | ||
| "order": 2, | ||
| "mode": 0, | ||
| "inputs": [], | ||
| "outputs": [ | ||
| { | ||
| "name": "COMBO", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "audio" | ||
| }, | ||
| "links": [3] | ||
| } | ||
| ], | ||
| "title": "audio", | ||
| "properties": { | ||
| "Run widget replace on values": false | ||
| }, | ||
| "widgets_values": ["linked-audio.wav", "fixed"] | ||
| }, | ||
| { | ||
| "id": 4, | ||
| "type": "LoadImage", | ||
| "pos": [360, 20], | ||
| "size": [315, 314], | ||
| "flags": {}, | ||
| "order": 3, | ||
| "mode": 0, | ||
| "inputs": [ | ||
| { | ||
| "name": "image", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "image" | ||
| }, | ||
| "link": 1 | ||
| } | ||
| ], | ||
| "outputs": [ | ||
| { | ||
| "name": "IMAGE", | ||
| "type": "IMAGE", | ||
| "links": null | ||
| }, | ||
| { | ||
| "name": "MASK", | ||
| "type": "MASK", | ||
| "links": null | ||
| } | ||
| ], | ||
| "properties": { | ||
| "Node name for S&R": "LoadImage" | ||
| }, | ||
| "widgets_values": ["linked-image.webp", "image"] | ||
| }, | ||
| { | ||
| "id": 5, | ||
| "type": "LoadVideo", | ||
| "pos": [360, 380], | ||
| "size": [315, 314], | ||
| "flags": {}, | ||
| "order": 4, | ||
| "mode": 0, | ||
| "inputs": [ | ||
| { | ||
| "name": "file", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "file" | ||
| }, | ||
| "link": 2 | ||
| } | ||
| ], | ||
| "outputs": [ | ||
| { | ||
| "name": "VIDEO", | ||
| "type": "VIDEO", | ||
| "links": null | ||
| } | ||
| ], | ||
| "properties": { | ||
| "Node name for S&R": "LoadVideo" | ||
| }, | ||
| "widgets_values": ["linked-video.mp4", "image"] | ||
| }, | ||
| { | ||
| "id": 6, | ||
| "type": "LoadAudio", | ||
| "pos": [360, 740], | ||
| "size": [315, 125], | ||
| "flags": {}, | ||
| "order": 5, | ||
| "mode": 0, | ||
| "inputs": [ | ||
| { | ||
| "name": "audio", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "audio" | ||
| }, | ||
| "link": 3 | ||
| } | ||
| ], | ||
| "outputs": [ | ||
| { | ||
| "name": "AUDIO", | ||
| "type": "AUDIO", | ||
| "links": null | ||
| } | ||
| ], | ||
| "properties": { | ||
| "Node name for S&R": "LoadAudio" | ||
| }, | ||
| "widgets_values": ["linked-audio.wav", null, ""] | ||
| } | ||
| ], | ||
| "links": [ | ||
| [1, 1, 0, 4, 0, "COMBO"], | ||
| [2, 2, 0, 5, 0, "COMBO"], | ||
| [3, 3, 0, 6, 0, "COMBO"] | ||
| ], | ||
| "groups": [], | ||
| "config": {}, | ||
| "extra": { | ||
| "ds": { | ||
| "scale": 0.8, | ||
| "offset": [0, 0] | ||
| } | ||
| }, | ||
| "version": 0.4 | ||
| } |
112 changes: 112 additions & 0 deletions
112
browser_tests/tests/vueNodes/widgets/load/linkedCoreMedia.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| import { AudioPreview, getWav } from '@e2e/fixtures/components/AudioPreview' | ||
| import { VideoPreview } from '@e2e/fixtures/components/VideoPreview' | ||
| import { | ||
| comfyExpect as expect, | ||
| comfyPageFixture as test | ||
| } from '@e2e/fixtures/ComfyPage' | ||
| import { assetPath } from '@e2e/fixtures/utils/paths' | ||
|
|
||
| test.describe('linked core media selectors', { tag: '@vue-nodes' }, () => { | ||
| test.beforeEach(async ({ comfyPage }) => { | ||
| await comfyPage.page.route('**/api/view?**', async (route) => { | ||
| const filename = new URL(route.request().url()).searchParams.get( | ||
| 'filename' | ||
| ) | ||
|
|
||
| if (filename === 'linked-image.webp') { | ||
| await route.fulfill({ | ||
| contentType: 'image/webp', | ||
| path: assetPath('image64x64.webp') | ||
| }) | ||
| return | ||
| } | ||
| if (filename === 'linked-video.mp4') { | ||
| await route.fulfill({ | ||
| contentType: 'video/mp4', | ||
| path: assetPath('plain_video.mp4') | ||
| }) | ||
| return | ||
| } | ||
| if (filename === 'linked-audio.wav') { | ||
| await route.fulfill({ | ||
| body: getWav(), | ||
| contentType: 'audio/x-wav' | ||
| }) | ||
| return | ||
| } | ||
|
|
||
| await route.fallback() | ||
| }) | ||
|
|
||
| await comfyPage.workflow.loadWorkflow('widgets/linked_core_media') | ||
| }) | ||
|
|
||
| test('hides local media until each selector is disconnected', async ({ | ||
|
jaeone94 marked this conversation as resolved.
|
||
| comfyPage | ||
| }) => { | ||
| const loadImage = await comfyPage.vueNodes.getFixtureByTitle('Load Image') | ||
| const loadVideo = comfyPage.vueNodes.getNodeByTitle('Load Video') | ||
| const loadAudio = comfyPage.vueNodes.getNodeByTitle('Load Audio') | ||
| const videoPreview = new VideoPreview(loadVideo) | ||
| const audioPreview = new AudioPreview(loadAudio) | ||
| const [[loadImageNode], [loadVideoNode], [loadAudioNode]] = | ||
| await Promise.all( | ||
| ['LoadImage', 'LoadVideo', 'LoadAudio'].map((type) => | ||
| comfyPage.nodeOps.getNodeRefsByType(type) | ||
| ) | ||
| ) | ||
|
|
||
| await expect(loadImage.imagePreview).toHaveCount(0) | ||
| await expect(videoPreview.preview).toHaveCount(0) | ||
| await expect(audioPreview.audio).toHaveCount(0) | ||
|
|
||
| const contextMenu = comfyPage.page.locator('.p-contextmenu') | ||
| await loadImageNode.centerOnNode() | ||
| await loadImage.header.click({ button: 'right' }) | ||
| await expect(contextMenu).toBeVisible() | ||
| await expect( | ||
| contextMenu.getByText('Open Image', { exact: true }) | ||
| ).toHaveCount(0) | ||
| await expect( | ||
| contextMenu.getByText('Paste Image', { exact: true }) | ||
| ).toHaveCount(0) | ||
| await comfyPage.page.keyboard.press('Escape') | ||
|
|
||
| const mediaNodes = [loadImage.root, loadVideo, loadAudio] | ||
| const linkedHeights = await Promise.all( | ||
| mediaNodes.map(async (node) => (await node.boundingBox())?.height ?? 0) | ||
| ) | ||
| expect( | ||
| linkedHeights, | ||
| 'Linked media nodes should have measurable fitted heights' | ||
| ).not.toContain(0) | ||
|
|
||
| for (const node of [loadImageNode, loadVideoNode, loadAudioNode]) { | ||
| await (await node.getInput(0)).removeLinks() | ||
| } | ||
|
|
||
| await expect(loadImage.imagePreview).toBeVisible() | ||
| await expect(loadImage.imagePreview.locator('img')).toBeVisible() | ||
| await expect(videoPreview.preview).toBeVisible() | ||
| await expect(videoPreview.video).toBeVisible() | ||
| await expect(audioPreview.audio).toBeAttached() | ||
|
jaeone94 marked this conversation as resolved.
Outdated
|
||
|
|
||
| for (const [index, node] of mediaNodes.entries()) { | ||
| await expect | ||
| .poll(() => node.boundingBox().then((box) => box?.height ?? 0), { | ||
| message: 'Restored local media should grow the fitted node' | ||
| }) | ||
| .toBeGreaterThan(linkedHeights[index]) | ||
| } | ||
|
|
||
| await loadImageNode.centerOnNode() | ||
| await loadImage.header.click({ button: 'right' }) | ||
| await expect(contextMenu).toBeVisible() | ||
| await expect( | ||
| contextMenu.getByText('Open Image', { exact: true }) | ||
| ).toBeVisible() | ||
| await expect( | ||
| contextMenu.getByText('Paste Image', { exact: true }) | ||
| ).toBeVisible() | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.