MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / getPropertyInfo

Method getPropertyInfo

src/LGraphNode.ts:1718–1749  ·  view source on GitHub ↗

* returns all the info available about a property of this node. * @param property name of the property * @returns the object with all the available info

(property: string)

Source from the content-addressed store, hash-verified

1716 * @returns the object with all the available info
1717 */
1718 getPropertyInfo(property: string) {
1719 let info = null
1720
1721 // there are several ways to define info about a property
1722 // legacy mode
1723 const { properties_info } = this
1724 if (properties_info) {
1725 for (const propInfo of properties_info) {
1726 if (propInfo.name == property) {
1727 info = propInfo
1728 break
1729 }
1730 }
1731 }
1732 // litescene mode using the constructor
1733 // @ts-expect-error deprecated https://github.com/Comfy-Org/litegraph.js/issues/639
1734 if (this.constructor[`@${property}`]) info = this.constructor[`@${property}`]
1735
1736 if (this.constructor.widgets_info?.[property])
1737 info = this.constructor.widgets_info[property]
1738
1739 // litescene mode using the constructor
1740 if (!info && this.onGetPropertyInfo) {
1741 info = this.onGetPropertyInfo(property)
1742 }
1743
1744 info ||= {}
1745 info.type ||= typeof this.properties[property]
1746 if (info.widget == "combo") info.type = "enum"
1747
1748 return info
1749 }
1750
1751 /**
1752 * Defines a widget inside the node, it will be rendered on top of the node, you can control lots of properties

Callers 3

showEditPropertyValueMethod · 0.80
inner_refreshMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected