mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-23 07:50:15 +00:00
feat: add settings option to always show advanced widgets on all nodes (#8244)
Solved issue: Currently, the display status of advanced widgets can only be set individually for each node, but users would like to have a global switch to always display all advanced widgets. I also adjusted some related code to solve the issue of code duplication. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8244-feat-add-settings-option-to-always-show-advanced-widgets-on-all-nodes-2f06d73d365081358023efa3e1ff3094) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -130,10 +130,16 @@
|
||||
'transition-all cursor-pointer hover:bg-accent-background duration-150 active:scale-95'
|
||||
)
|
||||
"
|
||||
@click.stop="handleShowAdvancedInputs"
|
||||
@click.stop="showAdvancedState = !showAdvancedState"
|
||||
>
|
||||
<i class="icon-[lucide--settings-2] size-4" />
|
||||
<span>{{ t('rightSidePanel.showAdvancedInputsButton') }}</span>
|
||||
<template v-if="showAdvancedState">
|
||||
<i class="icon-[lucide--chevron-up] size-4" />
|
||||
<span>{{ t('rightSidePanel.hideAdvancedInputsButton') }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<i class="icon-[lucide--settings-2] size-4" />
|
||||
<span>{{ t('rightSidePanel.showAdvancedInputsButton') }} </span>
|
||||
</template>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -152,7 +158,15 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { computed, nextTick, onErrorCaptured, onMounted, ref, watch } from 'vue'
|
||||
import {
|
||||
computed,
|
||||
customRef,
|
||||
nextTick,
|
||||
onErrorCaptured,
|
||||
onMounted,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
|
||||
@@ -212,6 +226,8 @@ const { nodeData, error = null } = defineProps<LGraphNodeProps>()
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
const { handleNodeCollapse, handleNodeTitleUpdate, handleNodeRightClick } =
|
||||
useNodeEventHandlers()
|
||||
const { bringNodeToFront } = useNodeZIndex()
|
||||
@@ -248,7 +264,7 @@ const bypassed = computed(
|
||||
const muted = computed((): boolean => nodeData.mode === LGraphEventMode.NEVER)
|
||||
|
||||
const nodeOpacity = computed(() => {
|
||||
const globalOpacity = useSettingStore().get('Comfy.Node.Opacity') ?? 1
|
||||
const globalOpacity = settingStore.get('Comfy.Node.Opacity') ?? 1
|
||||
|
||||
// For muted/bypassed nodes, apply the 0.5 multiplier on top of global opacity
|
||||
if (bypassed.value || muted.value) {
|
||||
@@ -493,20 +509,45 @@ const showAdvancedInputsButton = computed(() => {
|
||||
|
||||
// For regular nodes: show button if there are advanced widgets and they're currently hidden
|
||||
const hasAdvancedWidgets = nodeData.widgets?.some((w) => w.options?.advanced)
|
||||
return hasAdvancedWidgets && !node.showAdvanced
|
||||
const alwaysShowAdvanced = settingStore.get(
|
||||
'Comfy.Node.AlwaysShowAdvancedWidgets'
|
||||
)
|
||||
return hasAdvancedWidgets && !alwaysShowAdvanced
|
||||
})
|
||||
|
||||
function handleShowAdvancedInputs() {
|
||||
const node = lgraphNode.value
|
||||
if (!node) return
|
||||
const showAdvancedState = customRef((track, trigger) => {
|
||||
let internalState = false
|
||||
|
||||
if (node instanceof SubgraphNode) {
|
||||
const rightSidePanelStore = useRightSidePanelStore()
|
||||
rightSidePanelStore.focusSection('advanced-inputs')
|
||||
} else {
|
||||
node.showAdvanced = true
|
||||
const node = lgraphNode.value
|
||||
if (node && !(node instanceof SubgraphNode)) {
|
||||
internalState = !!node.showAdvanced
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
get() {
|
||||
track()
|
||||
return internalState
|
||||
},
|
||||
set(value: boolean) {
|
||||
const node = lgraphNode.value
|
||||
if (!node) return
|
||||
|
||||
if (node instanceof SubgraphNode) {
|
||||
// Do not modify internalState for subgraph nodes
|
||||
const rightSidePanelStore = useRightSidePanelStore()
|
||||
if (value) {
|
||||
rightSidePanelStore.focusSection('advanced-inputs')
|
||||
} else {
|
||||
rightSidePanelStore.closePanel()
|
||||
}
|
||||
} else {
|
||||
node.showAdvanced = value
|
||||
internalState = value
|
||||
}
|
||||
trigger()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const nodeMedia = computed(() => {
|
||||
const newOutputs = nodeOutputs.nodeOutputs[nodeOutputLocatorId.value]
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div
|
||||
v-if="
|
||||
!widget.simplified.options?.hidden &&
|
||||
(!widget.simplified.options?.advanced || nodeData?.showAdvanced)
|
||||
(!widget.simplified.options?.advanced || showAdvanced)
|
||||
"
|
||||
class="lg-node-widget group col-span-full grid grid-cols-subgrid items-stretch"
|
||||
>
|
||||
@@ -78,6 +78,7 @@ import type {
|
||||
VueNodeData,
|
||||
WidgetSlotMetadata
|
||||
} from '@/composables/graph/useGraphNodeManager'
|
||||
import { useSettingStore } from '@/platform/settings/settingStore'
|
||||
import { useErrorHandling } from '@/composables/useErrorHandling'
|
||||
import { st } from '@/i18n'
|
||||
import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions'
|
||||
@@ -130,6 +131,12 @@ onErrorCaptured((error) => {
|
||||
})
|
||||
|
||||
const nodeType = computed(() => nodeData?.type || '')
|
||||
const settingStore = useSettingStore()
|
||||
const showAdvanced = computed(
|
||||
() =>
|
||||
nodeData?.showAdvanced ||
|
||||
settingStore.get('Comfy.Node.AlwaysShowAdvancedWidgets')
|
||||
)
|
||||
const { getWidgetTooltip, createTooltipConfig } = useNodeTooltips(
|
||||
nodeType.value
|
||||
)
|
||||
@@ -213,7 +220,7 @@ const gridTemplateRows = computed((): string => {
|
||||
(w) =>
|
||||
processedNames.has(w.name) &&
|
||||
!w.options?.hidden &&
|
||||
(!w.options?.advanced || nodeData?.showAdvanced)
|
||||
(!w.options?.advanced || showAdvanced.value)
|
||||
)
|
||||
.map((w) =>
|
||||
shouldExpand(w.type) || w.hasLayoutSize ? 'auto' : 'min-content'
|
||||
|
||||
Reference in New Issue
Block a user