Skip to content
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

[3d] use vue to rewrite the UI for load3d #2467

Merged
merged 4 commits into from
Feb 9, 2025
Merged

[3d] use vue to rewrite the UI for load3d #2467

merged 4 commits into from
Feb 9, 2025

Conversation

jtydhr88
Copy link
Collaborator

@jtydhr88 jtydhr88 commented Feb 8, 2025

no feature added, but used vue to rewrite the UI for load3d

┆Issue is synchronized with this Notion page by Unito

controlsMount.style.pointerEvents = 'auto'
this.controlsContainer.appendChild(controlsMount)

this.controlsApp = createApp(Load3DAnimationControls, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we need to create a separate Vue app here? Mounting a new app will lost all configurations such as themes sync in the main app.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have to mount a new app to build UI on the top of threejs scence, which the only way I could figure it out...
currently, I don't use the configurations from main app in this UI yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that because the container is mounted directly under document? If you mount the container element under #vue-app, you should be able to mount the component under the main App instance.

Copy link
Collaborator Author

@jtydhr88 jtydhr88 Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each threejs scene renderer is under its own node's "image" filed Widget's HTMLElement as container

const sceneWidget = node.widgets.find((w: IWidget) => w.name === 'image')
const container = sceneWidget.element

and then

const rendererDomElement: HTMLCanvasElement = this.renderer.domElement
container.appendChild(rendererDomElement)

it doesn't have only single Threejs scene, it depends how many load3d nodes dropped on workflow.

Copy link
Collaborator Author

@jtydhr88 jtydhr88 Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I understand your concerns, but looks like it requires refactoring almost the whole code of load3d node by replacing the existing implementation completely with vue I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see the issue is here:

if (!element.parentElement) {
app.canvasContainer.append(element)
}

All DOM widgets are actually outside of #vue-app, so you can not directly mount vue component in dom widget. We need to fix this issue definitely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to merge this PR first as to get DOM widgets under #vue-app actually requires good amount of refactoring.

src/components/load3d/Load3DAnimationControls.vue Outdated Show resolved Hide resolved
@huchenlei
Copy link
Member

BTW you can refer https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/.cursorrules for general style guidelines.

@jtydhr88 jtydhr88 requested a review from huchenlei February 9, 2025 01:55
@huchenlei huchenlei merged commit 83cc49a into main Feb 9, 2025
10 checks passed
@huchenlei huchenlei deleted the use-vue branch February 9, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants