Added DinkLink scaffolding
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from .adv_control.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||
from .adv_control import documentation
|
||||
from .adv_control.dinklink import init_dinklink
|
||||
|
||||
WEB_DIRECTORY = "./web"
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', "WEB_DIRECTORY"]
|
||||
documentation.format_descriptions(NODE_CLASS_MAPPINGS)
|
||||
|
||||
init_dinklink()
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
####################################################################################################
|
||||
# DinkLink is my method of sharing classes/functions between my nodes.
|
||||
#
|
||||
# My DinkLink-compatible nodes will inject comfy.hooks with a __DINKLINK attr
|
||||
# that stores a dictionary, where any of my node packs can store their stuff.
|
||||
#
|
||||
# It is not intended to be accessed by node packs that I don't develop, so things may change
|
||||
# at any time.
|
||||
#
|
||||
# DinkLink also serves as a proof-of-concept for a future ComfyUI implementation of
|
||||
# purposely exposing node pack classes/functions with other node packs.
|
||||
####################################################################################################
|
||||
from __future__ import annotations
|
||||
import comfy.hooks
|
||||
from .sampling import acn_sampler_sample_wrapper
|
||||
|
||||
DINKLINK = "__DINKLINK"
|
||||
|
||||
def init_dinklink():
|
||||
if not hasattr(comfy.hooks, DINKLINK):
|
||||
setattr(comfy.hooks, DINKLINK, {})
|
||||
prepare_dinklink()
|
||||
|
||||
|
||||
def get_dinklink() -> dict[str, dict[str]]:
|
||||
return getattr(comfy.hooks, DINKLINK)
|
||||
|
||||
class Consts:
|
||||
ACN = "ACN"
|
||||
CREATE_SAMPLER_SAMPLE_WRAPPER = "create_sampler_sample_wrapper"
|
||||
|
||||
def prepare_dinklink():
|
||||
# expose acn_sampler_sample_wrapper
|
||||
d = get_dinklink()
|
||||
d.setdefault(Consts.ACN, {})[Consts.CREATE_SAMPLER_SAMPLE_WRAPPER] = None
|
||||
Reference in New Issue
Block a user