-
Notifications
You must be signed in to change notification settings - Fork 472
[3d] add output preview screen for load3d node #2464
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
Closed
Closed
Changes from all commits
Commits
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 |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ app.registerExtension({ | |
| container.id = `comfy-load-3d-${load3dNode.length}` | ||
| container.classList.add('comfy-load-3d') | ||
|
|
||
| const load3d = new Load3d(container) | ||
| const load3d = new Load3d(container, true) | ||
|
|
||
| containerToLoad3D.set(container.id, load3d) | ||
|
|
||
|
|
@@ -129,40 +129,34 @@ app.registerExtension({ | |
|
|
||
| const material = node.widgets.find((w: IWidget) => w.name === 'material') | ||
|
|
||
| const lightIntensity = node.widgets.find( | ||
| (w: IWidget) => w.name === 'light_intensity' | ||
| ) | ||
|
|
||
| const upDirection = node.widgets.find( | ||
| (w: IWidget) => w.name === 'up_direction' | ||
| ) | ||
|
|
||
| const fov = node.widgets.find((w: IWidget) => w.name === 'fov') | ||
|
|
||
| let cameraState = node.properties['Camera Info'] | ||
|
|
||
| const width = node.widgets.find((w: IWidget) => w.name === 'width') | ||
| const height = node.widgets.find((w: IWidget) => w.name === 'height') | ||
|
|
||
| const config = new Load3DConfiguration(load3d) | ||
|
|
||
| config.configure( | ||
| 'input', | ||
| modelWidget, | ||
| material, | ||
| lightIntensity, | ||
| upDirection, | ||
| fov, | ||
| cameraState | ||
| cameraState, | ||
| width, | ||
| height | ||
| ) | ||
|
|
||
| const w = node.widgets.find((w: IWidget) => w.name === 'width') | ||
| const h = node.widgets.find((w: IWidget) => w.name === 'height') | ||
|
|
||
| // @ts-expect-error hacky override | ||
| sceneWidget.serializeValue = async () => { | ||
| node.properties['Camera Info'] = load3d.getCameraState() | ||
|
|
||
| const { scene: imageData, mask: maskData } = await load3d.captureScene( | ||
| w.value, | ||
| h.value | ||
| width.value, | ||
| height.value | ||
| ) | ||
|
|
||
| const [data, dataMask] = await Promise.all([ | ||
|
|
@@ -194,7 +188,7 @@ app.registerExtension({ | |
| container.id = `comfy-load-3d-animation-${load3dNode.length}` | ||
| container.classList.add('comfy-load-3d-animation') | ||
|
|
||
| const load3d = new Load3dAnimation(container) | ||
| const load3d = new Load3dAnimation(container, true) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer using kwargs here. A boolean true second param will make reader confused. |
||
|
|
||
| containerToLoad3D.set(container.id, load3d) | ||
|
|
||
|
|
@@ -298,42 +292,36 @@ app.registerExtension({ | |
|
|
||
| const material = node.widgets.find((w: IWidget) => w.name === 'material') | ||
|
|
||
| const lightIntensity = node.widgets.find( | ||
| (w: IWidget) => w.name === 'light_intensity' | ||
| ) | ||
|
|
||
| const upDirection = node.widgets.find( | ||
| (w: IWidget) => w.name === 'up_direction' | ||
| ) | ||
|
|
||
| const fov = node.widgets.find((w: IWidget) => w.name === 'fov') | ||
|
|
||
| let cameraState = node.properties['Camera Info'] | ||
|
|
||
| const width = node.widgets.find((w: IWidget) => w.name === 'width') | ||
| const height = node.widgets.find((w: IWidget) => w.name === 'height') | ||
|
|
||
| const config = new Load3DConfiguration(load3d) | ||
|
|
||
| config.configure( | ||
| 'input', | ||
| modelWidget, | ||
| material, | ||
| lightIntensity, | ||
| upDirection, | ||
| fov, | ||
| cameraState | ||
| cameraState, | ||
| width, | ||
| height | ||
| ) | ||
|
|
||
| const w = node.widgets.find((w: IWidget) => w.name === 'width') | ||
| const h = node.widgets.find((w: IWidget) => w.name === 'height') | ||
|
|
||
| // @ts-expect-error hacky override | ||
| sceneWidget.serializeValue = async () => { | ||
| node.properties['Camera Info'] = load3d.getCameraState() | ||
|
|
||
| load3d.toggleAnimation(false) | ||
|
|
||
| const { scene: imageData, mask: maskData } = await load3d.captureScene( | ||
| w.value, | ||
| h.value | ||
| width.value, | ||
| height.value | ||
| ) | ||
|
|
||
| const [data, dataMask] = await Promise.all([ | ||
|
|
@@ -432,16 +420,10 @@ app.registerExtension({ | |
|
|
||
| const material = node.widgets.find((w: IWidget) => w.name === 'material') | ||
|
|
||
| const lightIntensity = node.widgets.find( | ||
| (w: IWidget) => w.name === 'light_intensity' | ||
| ) | ||
|
|
||
| const upDirection = node.widgets.find( | ||
| (w: IWidget) => w.name === 'up_direction' | ||
| ) | ||
|
|
||
| const fov = node.widgets.find((w: IWidget) => w.name === 'fov') | ||
|
|
||
| const onExecuted = node.onExecuted | ||
|
|
||
| node.onExecuted = function (message: any) { | ||
|
|
@@ -461,14 +443,7 @@ app.registerExtension({ | |
|
|
||
| const config = new Load3DConfiguration(load3d) | ||
|
|
||
| config.configure( | ||
| 'output', | ||
| modelWidget, | ||
| material, | ||
| lightIntensity, | ||
| upDirection, | ||
| fov | ||
| ) | ||
| config.configure('output', modelWidget, material, upDirection) | ||
| } | ||
| } | ||
| }) | ||
|
|
@@ -562,16 +537,10 @@ app.registerExtension({ | |
|
|
||
| const material = node.widgets.find((w: IWidget) => w.name === 'material') | ||
|
|
||
| const lightIntensity = node.widgets.find( | ||
| (w: IWidget) => w.name === 'light_intensity' | ||
| ) | ||
|
|
||
| const upDirection = node.widgets.find( | ||
| (w: IWidget) => w.name === 'up_direction' | ||
| ) | ||
|
|
||
| const fov = node.widgets.find((w: IWidget) => w.name === 'fov') | ||
|
|
||
| const onExecuted = node.onExecuted | ||
|
|
||
| node.onExecuted = function (message: any) { | ||
|
|
@@ -591,14 +560,7 @@ app.registerExtension({ | |
|
|
||
| const config = new Load3DConfiguration(load3d) | ||
|
|
||
| config.configure( | ||
| 'output', | ||
| modelWidget, | ||
| material, | ||
| lightIntensity, | ||
| upDirection, | ||
| fov | ||
| ) | ||
| config.configure('output', modelWidget, material, upDirection) | ||
| } | ||
| } | ||
| }) | ||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer using kwargs here. A boolean true second param will make reader confused.