mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-02 20:22:08 +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]
|
||||
|
||||
Reference in New Issue
Block a user