wip cleanup, filtering, setdirty

This commit is contained in:
Austin Mroz
2025-09-05 10:11:51 -05:00
parent 4150b1ccb4
commit b424c62a99
2 changed files with 7 additions and 16 deletions

View File

@@ -32,25 +32,16 @@ const { t } = useI18n()
const canvasStore = useCanvasStore()
const items = ref(null)
const expandedKeys = ref<Record<string, boolean>>({})
watchDebounced(items,() => {
console.log(items.value.map(i => `${i[0].title}: ${i[1].name}`))
}, { debounce: 500 }
)
const widgetTree = computed(() => {
const node = canvasStore.selectedItems[0] ?? {}
const interiorNodes = node?.subgraph?.nodes ?? []
if (!interiorNodes) {
items.value = null
return
}
node.widgets ??= []
const intn = interiorNodes.map((n) =>
n.widgets?.map((w) => [n, w, node]) ?? []).flat(1)
//items.value = intn
//widget has connected link. Should not be displayed
.filter((i) => !i[1].computedDisabled)
//TODO: filter enabled/disabled items while keeping order
console.log(intn)
return buildTree(intn, (item: [unknown, unknown]) =>
@@ -58,8 +49,6 @@ const widgetTree = computed(() => {
)
})
const renderedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(() => {
const fillNodeInfo = (node: TreeNode): TreeExplorerNode<ComfyNodeDefImpl> => {
const children = node.children?.map(fillNodeInfo)
@@ -77,9 +66,7 @@ const renderedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(() => {
draggable: true,
}
}
console.log(widgetTree.value)
const ret = fillNodeInfo(widgetTree.value)
console.log(ret)
return ret
})

View File

@@ -20,6 +20,7 @@
import { ref, onMounted } from 'vue'
import Button from 'primevue/button'
import { useDomWidgetStore } from '@/stores/domWidgetStore'
import { useCanvasStore } from '@/stores/graphStore'
function hasWidget() {
const node = props.node.data[2]
@@ -45,7 +46,6 @@ function onClick(e) {
const widgetName = props.node.data[1].name
const node = props.node.data[2]
console.log(isShown.value)
const { widgetStates } = useDomWidgetStore()
if (!isShown.value) {
const w = node.addProxyWidget(`${nodeId}`, widgetName)
@@ -63,8 +63,12 @@ function onClick(e) {
if (widgetStates.has(w.id)) {
widgetStates.get(w.id).active = false
}
const { properties } = node
properties.proxyWidgets = properties.proxyWidgets.filter((p) => p[1] !== widgetName)
isShown.value = false
}
useCanvasStore().canvas.setDirty(true)
}
</script>