Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0db79787d | ||
|
|
2dc014a33e | ||
|
|
d8d163cd90 | ||
|
|
8c277d92bd | ||
|
|
90fb133120 |
+1
-2
@@ -4,15 +4,14 @@ from .animatediff.utils_model import get_available_motion_models, Folders
|
||||
from .animatediff.model_injection import prepare_dinklink_register_definitions
|
||||
from .animatediff.motion_module_ad import prepare_dinklink_motion_module_ad
|
||||
from .animatediff.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||
from .animatediff import documentation
|
||||
from .animatediff.dinklink import init_dinklink
|
||||
|
||||
if len(get_available_motion_models()) == 0:
|
||||
logger.error(f"No motion models found. Please download one and place in: {folder_paths.get_folder_paths(Folders.ANIMATEDIFF_MODELS)}")
|
||||
|
||||
WEB_DIRECTORY = "./web"
|
||||
|
||||
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
|
||||
documentation.format_descriptions(NODE_CLASS_MAPPINGS)
|
||||
|
||||
init_dinklink()
|
||||
prepare_dinklink_register_definitions()
|
||||
|
||||
@@ -70,9 +70,9 @@ def load_hmreferenceadapter(model_name: str):
|
||||
else:
|
||||
ops = comfy.ops.manual_cast
|
||||
hmref = HMReferenceAdapter(ops=ops)
|
||||
hmref.to(comfy.model_management.unet_dtype())
|
||||
hmref.to(comfy.model_management.unet_offload_device())
|
||||
load_result = hmref.load_state_dict(state_dict, strict=True)
|
||||
hmref.to(comfy.model_management.unet_dtype())
|
||||
hmref_model = create_HMModelPatcher(model=hmref, load_device=comfy.model_management.get_torch_device(),
|
||||
offload_device=comfy.model_management.unet_offload_device())
|
||||
return hmref_model
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
from typing import Union
|
||||
|
||||
from .logger import logger
|
||||
|
||||
def image(src):
|
||||
return f'<img src={src} style="width: 0px; min-width: 100%">'
|
||||
def video(src):
|
||||
return f'<video src={src} autoplay muted loop controls controlslist="nodownload noremoteplayback noplaybackrate" style="width: 0px; min-width: 100%" class="VHS_loopedvideo">'
|
||||
def short_desc(desc):
|
||||
return f'<div id=VHS_shortdesc style="font-size: .8em">{desc}</div>'
|
||||
|
||||
def coll(text: str):
|
||||
return f"{text}_collapsed"
|
||||
|
||||
descriptions = {
|
||||
}
|
||||
|
||||
sizes = ['1.4','1.2','1']
|
||||
def as_html(entry, depth=0):
|
||||
if isinstance(entry, dict):
|
||||
size = 0.8 if depth < 2 else 1
|
||||
html = ''
|
||||
for k in entry:
|
||||
if k == "collapsed":
|
||||
continue
|
||||
collapse_single = k.endswith("_collapsed")
|
||||
if collapse_single:
|
||||
name = k[:-len("_collapsed")]
|
||||
else:
|
||||
name = k
|
||||
collapse_flag = ' VHS_precollapse' if entry.get("collapsed", False) or collapse_single else ''
|
||||
html += f'<div vhs_title=\"{name}\" style=\"display: flex; font-size: {size}em\" class=\"VHS_collapse{collapse_flag}\"><div style=\"color: #AAA; height: 1.5em;\">[<span style=\"font-family: monospace\">-</span>]</div><div style=\"width: 100%\">{name}: {as_html(entry[k], depth=depth+1)}</div></div>'
|
||||
return html
|
||||
if isinstance(entry, list):
|
||||
html = ''
|
||||
for i in entry:
|
||||
html += f'<div>{as_html(i, depth=depth)}</div>'
|
||||
return html
|
||||
return str(entry)
|
||||
|
||||
|
||||
def register_description(node_id: str, desc: Union[list, dict]):
|
||||
descriptions[node_id] = desc
|
||||
|
||||
|
||||
def format_descriptions(nodes):
|
||||
for k in descriptions:
|
||||
if k.endswith("_collapsed"):
|
||||
k = k[:-len("_collapsed")]
|
||||
nodes[k].DESCRIPTION = as_html(descriptions[k])
|
||||
# undocumented_nodes = []
|
||||
# for k in nodes:
|
||||
# if not hasattr(nodes[k], "DESCRIPTION"):
|
||||
# undocumented_nodes.append(k)
|
||||
# if len(undocumented_nodes) > 0:
|
||||
# logger.info(f"Undocumented nodes: {undocumented_nodes}")
|
||||
|
||||
|
||||
class DocHelper:
|
||||
def __init__(self):
|
||||
self.actual_dict = {}
|
||||
|
||||
def add(self, add_dict):
|
||||
self.actual_dict.update(add_dict)
|
||||
return self
|
||||
|
||||
def get(self):
|
||||
return self.actual_dict
|
||||
|
||||
@staticmethod
|
||||
def combine(*args):
|
||||
docs = DocHelper()
|
||||
for doc in args:
|
||||
docs.add(doc)
|
||||
return docs.get()
|
||||
@@ -841,9 +841,9 @@ def load_motion_module_gen1(model_name: str, model: ModelPatcher, motion_lora: M
|
||||
mm_state_dict = apply_mm_settings(model_dict=mm_state_dict, mm_settings=motion_model_settings)
|
||||
# initialize AnimateDiffModelWrapper
|
||||
ad_wrapper = AnimateDiffModel(mm_state_dict=mm_state_dict, mm_info=mm_info)
|
||||
ad_wrapper.to(model.model_dtype())
|
||||
ad_wrapper.to(model.offload_device)
|
||||
load_result = ad_wrapper.load_state_dict(mm_state_dict, strict=False)
|
||||
ad_wrapper.to(model.model_dtype())
|
||||
verify_load_result(load_result=load_result, mm_info=mm_info)
|
||||
# wrap motion_module into a ModelPatcher, to allow motion lora patches
|
||||
motion_model = create_MotionModelPatcher(model=ad_wrapper, load_device=model.load_device, offload_device=model.offload_device)
|
||||
@@ -865,9 +865,9 @@ def load_motion_module_gen2(model_name: str, motion_model_settings: AnimateDiffS
|
||||
mm_state_dict = apply_mm_settings(model_dict=mm_state_dict, mm_settings=motion_model_settings)
|
||||
# initialize AnimateDiffModelWrapper
|
||||
ad_wrapper = AnimateDiffModel(mm_state_dict=mm_state_dict, mm_info=mm_info)
|
||||
ad_wrapper.to(comfy.model_management.unet_dtype())
|
||||
ad_wrapper.to(comfy.model_management.unet_offload_device())
|
||||
load_result = ad_wrapper.load_state_dict(mm_state_dict, strict=False)
|
||||
ad_wrapper.to(comfy.model_management.unet_dtype())
|
||||
verify_load_result(load_result=load_result, mm_info=mm_info)
|
||||
# wrap motion_module into a ModelPatcher, to allow motion lora patches
|
||||
motion_model = create_MotionModelPatcher(model=ad_wrapper, load_device=comfy.model_management.get_torch_device(),
|
||||
@@ -907,34 +907,34 @@ def verify_load_result(load_result: IncompatibleKeys, mm_info: AnimateDiffInfo):
|
||||
|
||||
def create_fresh_motion_module(motion_model: MotionModelPatcher) -> MotionModelPatcher:
|
||||
ad_wrapper = AnimateDiffModel(mm_state_dict=motion_model.model.state_dict(), mm_info=motion_model.model.mm_info)
|
||||
ad_wrapper.to(comfy.model_management.unet_dtype())
|
||||
ad_wrapper.to(comfy.model_management.unet_offload_device())
|
||||
ad_wrapper.load_state_dict(motion_model.model.state_dict())
|
||||
ad_wrapper.to(comfy.model_management.unet_dtype())
|
||||
return create_MotionModelPatcher(model=ad_wrapper, load_device=comfy.model_management.get_torch_device(),
|
||||
offload_device=comfy.model_management.unet_offload_device())
|
||||
|
||||
|
||||
def create_fresh_encoder_only_model(motion_model: MotionModelPatcher) -> MotionModelPatcher:
|
||||
ad_wrapper = EncoderOnlyAnimateDiffModel(mm_state_dict=motion_model.model.state_dict(), mm_info=motion_model.model.mm_info)
|
||||
ad_wrapper.to(comfy.model_management.unet_dtype())
|
||||
ad_wrapper.to(comfy.model_management.unet_offload_device())
|
||||
ad_wrapper.load_state_dict(motion_model.model.state_dict(), strict=False)
|
||||
ad_wrapper.to(comfy.model_management.unet_dtype())
|
||||
return create_MotionModelPatcher(model=ad_wrapper, load_device=comfy.model_management.get_torch_device(),
|
||||
offload_device=comfy.model_management.unet_offload_device())
|
||||
|
||||
|
||||
def inject_img_encoder_into_model(motion_model: MotionModelPatcher, w_encoder: MotionModelPatcher):
|
||||
motion_model.model.init_img_encoder()
|
||||
motion_model.model.img_encoder.to(comfy.model_management.unet_dtype())
|
||||
motion_model.model.img_encoder.to(comfy.model_management.unet_offload_device())
|
||||
motion_model.model.img_encoder.load_state_dict(w_encoder.model.img_encoder.state_dict())
|
||||
motion_model.model.img_encoder.to(comfy.model_management.unet_dtype())
|
||||
|
||||
|
||||
def inject_pia_conv_in_into_model(motion_model: MotionModelPatcher, w_pia: MotionModelPatcher):
|
||||
motion_model.model.init_conv_in(w_pia.model.state_dict())
|
||||
motion_model.model.conv_in.to(comfy.model_management.unet_dtype())
|
||||
motion_model.model.conv_in.to(comfy.model_management.unet_offload_device())
|
||||
motion_model.model.conv_in.load_state_dict(w_pia.model.conv_in.state_dict())
|
||||
motion_model.model.conv_in.to(comfy.model_management.unet_dtype())
|
||||
motion_model.model.mm_info.mm_format = AnimateDiffFormat.PIA
|
||||
|
||||
|
||||
@@ -956,9 +956,9 @@ def inject_camera_encoder_into_model(motion_model: MotionModelPatcher, camera_ct
|
||||
# initialize CameraPoseEncoder on motion model, and load keys
|
||||
camera_encoder = CameraPoseEncoder(channels=motion_model.model.layer_channels, nums_rb=2, ops=motion_model.model.ops).to(
|
||||
device=comfy.model_management.unet_offload_device(),
|
||||
dtype=comfy.model_management.unet_dtype()
|
||||
)
|
||||
camera_encoder.load_state_dict(camera_state_dict)
|
||||
camera_encoder.to(dtype=comfy.model_management.unet_dtype())
|
||||
camera_encoder.temporal_pe_max_len = get_position_encoding_max_len(camera_state_dict, mm_name=camera_ctrl_name, mm_format=AnimateDiffFormat.ANIMATEDIFF)
|
||||
motion_model.model.set_camera_encoder(camera_encoder=camera_encoder)
|
||||
# initialize qkv_merge on specific attention blocks, and load keys
|
||||
|
||||
@@ -10,9 +10,6 @@ class AnimateDiffSettingsNode:
|
||||
"pe_adjust": ("PE_ADJUST",),
|
||||
"weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AD_SETTINGS",)
|
||||
@@ -38,9 +35,6 @@ class ManualAdjustPENode:
|
||||
"optional": {
|
||||
"prev_pe_adjust": ("PE_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("PE_ADJUST",)
|
||||
@@ -72,9 +66,6 @@ class SweetspotStretchPENode:
|
||||
"optional": {
|
||||
"prev_pe_adjust": ("PE_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("PE_ADJUST",)
|
||||
@@ -102,9 +93,6 @@ class FullStretchPENode:
|
||||
"optional": {
|
||||
"prev_pe_adjust": ("PE_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("PE_ADJUST",)
|
||||
@@ -132,9 +120,6 @@ class WeightAdjustAllAddNode:
|
||||
"optional": {
|
||||
"prev_weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("WEIGHT_ADJUST",)
|
||||
@@ -164,9 +149,6 @@ class WeightAdjustAllMultNode:
|
||||
"optional": {
|
||||
"prev_weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("WEIGHT_ADJUST",)
|
||||
@@ -198,9 +180,6 @@ class WeightAdjustIndivAddNode:
|
||||
"optional": {
|
||||
"prev_weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("WEIGHT_ADJUST",)
|
||||
@@ -234,9 +213,6 @@ class WeightAdjustIndivMultNode:
|
||||
"optional": {
|
||||
"prev_weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("WEIGHT_ADJUST",)
|
||||
@@ -275,9 +251,6 @@ class WeightAdjustIndivAttnAddNode:
|
||||
"optional": {
|
||||
"prev_weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("WEIGHT_ADJUST",)
|
||||
@@ -324,9 +297,6 @@ class WeightAdjustIndivAttnMultNode:
|
||||
"optional": {
|
||||
"prev_weight_adjust": ("WEIGHT_ADJUST",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("WEIGHT_ADJUST",)
|
||||
|
||||
@@ -36,9 +36,6 @@ class ApplyAnimateLCMI2VModel:
|
||||
"prev_m_models": ("M_MODELS",),
|
||||
"per_block": ("PER_BLOCK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("M_MODELS",)
|
||||
@@ -96,6 +93,7 @@ class LoadAnimateLCMI2VModelNode:
|
||||
|
||||
|
||||
class LoadAnimateDiffAndInjectI2VNode:
|
||||
EXPERIMENTAL = True
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -105,7 +103,6 @@ class LoadAnimateDiffAndInjectI2VNode:
|
||||
},
|
||||
"optional": {
|
||||
"ad_settings": ("AD_SETTINGS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Experimental. Don't expect to work.", "warn_type": "experimental", "color": "#CFC"}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -301,9 +301,6 @@ class CameraCtrlADKeyframeNode:
|
||||
"inherit_missing": ("BOOLEAN", {"default": True}, ),
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AD_KEYFRAMES", )
|
||||
@@ -403,9 +400,6 @@ class CameraCtrlPoseBasic:
|
||||
"optional": {
|
||||
"prev_poses": ("CAMERACTRL_POSES",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CAMERACTRL_POSES",)
|
||||
|
||||
@@ -45,11 +45,7 @@ class CreateLoraHookKeyframeInterpolationDEPR:
|
||||
},
|
||||
"optional": {
|
||||
"prev_hook_kf": ("HOOK_KEYFRAMES",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
DEPRECATED = True
|
||||
@@ -98,11 +94,7 @@ class PairedConditioningSetMaskHookedDEPR:
|
||||
"opt_mask": ("MASK", ),
|
||||
"opt_lora_hook": ("HOOKS",),
|
||||
"opt_timesteps": ("TIMESTEPS_RANGE",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING")
|
||||
@@ -133,11 +125,7 @@ class ConditioningSetMaskHookedDEPR:
|
||||
"opt_mask": ("MASK", ),
|
||||
"opt_lora_hook": ("HOOKS",),
|
||||
"opt_timesteps": ("TIMESTEPS_RANGE",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
@@ -170,11 +158,7 @@ class PairedConditioningSetMaskAndCombineHookedDEPR:
|
||||
"opt_mask": ("MASK", ),
|
||||
"opt_lora_hook": ("HOOKS",),
|
||||
"opt_timesteps": ("TIMESTEPS_RANGE",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING")
|
||||
@@ -206,11 +190,7 @@ class ConditioningSetMaskAndCombineHookedDEPR:
|
||||
"opt_mask": ("MASK", ),
|
||||
"opt_lora_hook": ("HOOKS",),
|
||||
"opt_timesteps": ("TIMESTEPS_RANGE",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
@@ -239,11 +219,7 @@ class PairedConditioningSetUnmaskedAndCombineHookedDEPR:
|
||||
},
|
||||
"optional": {
|
||||
"opt_lora_hook": ("HOOKS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING")
|
||||
@@ -269,11 +245,7 @@ class ConditioningSetUnmaskedAndCombineHookedDEPR:
|
||||
},
|
||||
"optional": {
|
||||
"opt_lora_hook": ("HOOKS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
@@ -298,9 +270,6 @@ class PairedConditioningCombineDEPR:
|
||||
"positive_B": ("CONDITIONING",),
|
||||
"negative_B": ("CONDITIONING",),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING")
|
||||
@@ -322,9 +291,6 @@ class ConditioningCombineDEPR:
|
||||
"cond_A": ("CONDITIONING",),
|
||||
"cond_B": ("CONDITIONING",),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
@@ -352,12 +318,6 @@ class ConditioningTimestepsNodeDEPR:
|
||||
"start_percent": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
"end_percent": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001})
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("TIMESTEPS_RANGE",)
|
||||
@@ -377,12 +337,6 @@ class SetLoraHookKeyframesDEPR:
|
||||
"lora_hook": ("HOOKS",),
|
||||
"hook_kf": ("HOOK_KEYFRAMES",),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("HOOKS",)
|
||||
@@ -407,11 +361,7 @@ class CreateLoraHookKeyframeDEPR:
|
||||
},
|
||||
"optional": {
|
||||
"prev_hook_kf": ("HOOK_KEYFRAMES",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("HOOK_KEYFRAMES",)
|
||||
@@ -443,7 +393,6 @@ class CreateLoraHookKeyframeFromStrengthListDEPR:
|
||||
},
|
||||
"optional": {
|
||||
"prev_hook_kf": ("HOOK_KEYFRAMES",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,9 +450,6 @@ class MaskableLoraLoaderDEPR:
|
||||
"strength_model": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}),
|
||||
"strength_clip": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "CLIP", "HOOKS")
|
||||
@@ -543,9 +489,6 @@ class MaskableLoraLoaderModelOnlyDEPR(MaskableLoraLoaderDEPR):
|
||||
"lora_name": (folder_paths.get_filename_list("loras"), ),
|
||||
"strength_model": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "HOOKS")
|
||||
@@ -570,9 +513,6 @@ class MaskableSDModelLoaderDEPR(comfy_extras.nodes_hooks.CreateHookModelAsLora):
|
||||
"strength_model": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}),
|
||||
"strength_clip": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "CLIP", "HOOKS")
|
||||
@@ -594,9 +534,6 @@ class MaskableSDModelLoaderModelOnlyDEPR(MaskableSDModelLoaderDEPR):
|
||||
"ckpt_name": (folder_paths.get_filename_list("checkpoints"), ),
|
||||
"strength_model": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "HOOKS")
|
||||
@@ -625,12 +562,6 @@ class SetModelLoraHookDEPR:
|
||||
"conditioning": ("CONDITIONING",),
|
||||
"lora_hook": ("HOOKS",),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
@@ -650,12 +581,6 @@ class SetClipLoraHookDEPR:
|
||||
"clip": ("CLIP",),
|
||||
"lora_hook": ("HOOKS",),
|
||||
},
|
||||
"optional": {
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CLIP",)
|
||||
@@ -677,11 +602,7 @@ class CombineLoraHooksDEPR:
|
||||
"optional": {
|
||||
"lora_hook_A": ("HOOKS",),
|
||||
"lora_hook_B": ("HOOKS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("HOOKS",)
|
||||
@@ -705,11 +626,7 @@ class CombineLoraHookFourOptionalDEPR:
|
||||
"lora_hook_B": ("HOOKS",),
|
||||
"lora_hook_C": ("HOOKS",),
|
||||
"lora_hook_D": ("HOOKS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("HOOKS",)
|
||||
@@ -739,11 +656,7 @@ class CombineLoraHookEightOptionalDEPR:
|
||||
"lora_hook_F": ("HOOKS",),
|
||||
"lora_hook_G": ("HOOKS",),
|
||||
"lora_hook_H": ("HOOKS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("HOOKS",)
|
||||
|
||||
@@ -66,6 +66,7 @@ class LoopedUniformContextOptionsNode:
|
||||
|
||||
# This Legacy version exists to maintain compatiblity with old workflows
|
||||
class LegacyLoopedUniformContextOptionsNode:
|
||||
DEPRECATED = True
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -84,7 +85,6 @@ class LegacyLoopedUniformContextOptionsNode:
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
"prev_context": ("CONTEXT_OPTIONS",),
|
||||
"view_opts": ("VIEW_OPTS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": ""}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,9 +237,6 @@ class ViewAsContextOptionsNode:
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
"prev_context": ("CONTEXT_OPTIONS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXT_OPTIONS",)
|
||||
|
||||
@@ -21,9 +21,6 @@ class SetContextExtrasOnContextOptions:
|
||||
"optional": {
|
||||
"context_extras": ("CONTEXT_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXT_OPTIONS",)
|
||||
@@ -54,9 +51,6 @@ class ContextExtras_NaiveReuse:
|
||||
"end_percent": ("FLOAT", {"default": 0.15, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
"weighted_mean": ("FLOAT", {"default": 0.95, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXT_EXTRAS",)
|
||||
@@ -89,9 +83,6 @@ class NaiveReuse_KeyframeMultivalNode:
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
"inherit_missing": ("BOOLEAN", {"default": True}, ),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NAIVEREUSE_KEYFRAME",)
|
||||
@@ -128,9 +119,6 @@ class NaiveReuse_KeyframeInterpolationNode:
|
||||
"prev_kf": ("NAIVEREUSE_KEYFRAME",),
|
||||
"mult_multival": ("MULTIVAL",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NAIVEREUSE_KEYFRAME",)
|
||||
@@ -178,9 +166,6 @@ class NaiveReuse_KeyframeFromListNode:
|
||||
"prev_kf": ("NAIVEREUSE_KEYFRAME",),
|
||||
"mult_multival": ("MULTIVAL",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NAIVEREUSE_KEYFRAME",)
|
||||
@@ -235,9 +220,6 @@ class ContextExtras_ContextRef:
|
||||
"start_percent": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
"end_percent": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXT_EXTRAS",)
|
||||
@@ -279,9 +261,6 @@ class ContextRef_KeyframeMultivalNode:
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
"inherit_missing": ("BOOLEAN", {"default": True}, ),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_KEYFRAME",)
|
||||
@@ -321,9 +300,6 @@ class ContextRef_KeyframeInterpolationNode:
|
||||
"mode_replace": ("CONTEXTREF_MODE",),
|
||||
"tune_replace": ("CONTEXTREF_TUNE",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_KEYFRAME",)
|
||||
@@ -372,9 +348,6 @@ class ContextRef_KeyframeFromListNode:
|
||||
"mode_replace": ("CONTEXTREF_MODE",),
|
||||
"tune_replace": ("CONTEXTREF_TUNE",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_KEYFRAME",)
|
||||
@@ -416,9 +389,6 @@ class ContextRef_ModeFirst:
|
||||
return {
|
||||
"required": {
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_MODE",)
|
||||
@@ -439,9 +409,6 @@ class ContextRef_ModeSliding:
|
||||
"optional": {
|
||||
"sliding_width": ("INT", {"default": 2, "min": 2, "max": BIGMAX, "step": 1}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_MODE",)
|
||||
@@ -463,9 +430,6 @@ class ContextRef_ModeIndexes:
|
||||
"switch_on_idxs": ("STRING", {"default": ""}),
|
||||
"always_include_0": ("BOOLEAN", {"default": True},),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_MODE",)
|
||||
@@ -494,9 +458,6 @@ class ContextRef_TuneAttnAdain:
|
||||
"adain_ref_weight": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
"adain_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_TUNE",)
|
||||
@@ -522,9 +483,6 @@ class ContextRef_TuneAttn:
|
||||
"attn_ref_weight": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
"attn_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONTEXTREF_TUNE",)
|
||||
|
||||
@@ -34,7 +34,6 @@ class AnimateDiffLoaderDEPR:
|
||||
"unlimited_area_hack": ("BOOLEAN", {"default": False},),
|
||||
"beta_schedule": (BetaSchedules.get_alias_list_with_first_element(BetaSchedules.SQRT_LINEAR),),
|
||||
},
|
||||
"optional": {"deprecation_warning": ("ADEWARN", {"text": "Deprecated"})},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "LATENT")
|
||||
@@ -95,7 +94,6 @@ class AnimateDiffLoaderAdvancedDEPR:
|
||||
"closed_loop": ("BOOLEAN", {"default": False},),
|
||||
"beta_schedule": (BetaSchedules.get_alias_list_with_first_element(BetaSchedules.SQRT_LINEAR),),
|
||||
},
|
||||
"optional": {"deprecation_warning": ("ADEWARN", {"text": "Deprecated"})},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "LATENT")
|
||||
@@ -171,7 +169,6 @@ class LegacyAnimateDiffLoaderWithContextDEPR:
|
||||
"motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"apply_v2_models_properly": ("BOOLEAN", {"default": True}),
|
||||
"ad_keyframes": ("AD_KEYFRAMES",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated; use AnimateDiff Loader instead."}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +266,6 @@ class AnimateDiffCombineDEPR:
|
||||
"pingpong": ("BOOLEAN", {"default": False}),
|
||||
"save_image": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
"optional": {"deprecation_warning": ("ADEWARN", {"text": "Deprecated. Use VHS Video Combine"})},
|
||||
"hidden": {
|
||||
"prompt": "PROMPT",
|
||||
"extra_pnginfo": "EXTRA_PNGINFO",
|
||||
@@ -380,7 +376,7 @@ class AnimateDiffCombineDEPR:
|
||||
"format": format,
|
||||
}
|
||||
]
|
||||
return {"ui": {"gifs": previews}}
|
||||
return {"ui": {"images": previews, "animated": (True,)}}
|
||||
|
||||
|
||||
|
||||
@@ -394,7 +390,6 @@ class AnimateDiffModelSettingsDEPR:
|
||||
},
|
||||
"optional": {
|
||||
"mask_motion_scale": ("MASK",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated"}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +419,6 @@ class AnimateDiffModelSettingsSimpleDEPR:
|
||||
"mask_motion_scale": ("MASK",),
|
||||
"min_motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"max_motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated"}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +458,6 @@ class AnimateDiffModelSettingsAdvancedDEPR:
|
||||
"mask_motion_scale": ("MASK",),
|
||||
"min_motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"max_motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated"}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +513,6 @@ class AnimateDiffModelSettingsAdvancedAttnStrengthsDEPR:
|
||||
"mask_motion_scale": ("MASK",),
|
||||
"min_motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"max_motion_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "step": 0.001}),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Deprecated"}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,6 @@ class ApplyAnimateDiffFancyVideo:
|
||||
"prev_m_models": ("M_MODELS",),
|
||||
"per_block": ("PER_BLOCK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("M_MODELS",)
|
||||
|
||||
@@ -101,9 +101,6 @@ class ApplyAnimateDiffModelNode:
|
||||
"prev_m_models": ("M_MODELS",),
|
||||
"per_block": ("PER_BLOCK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("M_MODELS",)
|
||||
@@ -156,9 +153,6 @@ class ApplyAnimateDiffModelBasicNode:
|
||||
"ad_keyframes": ("AD_KEYFRAMES",),
|
||||
"per_block": ("PER_BLOCK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("M_MODELS",)
|
||||
@@ -185,9 +179,6 @@ class LoadAnimateDiffModelNode:
|
||||
"optional": {
|
||||
"ad_settings": ("AD_SETTINGS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 50}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MOTION_MODEL_ADE",)
|
||||
@@ -216,9 +207,6 @@ class ADKeyframeNode:
|
||||
"inherit_missing": ("BOOLEAN", {"default": True}, ),
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AD_KEYFRAMES", )
|
||||
|
||||
@@ -20,9 +20,6 @@ class AnimateDiffLoraLoader:
|
||||
"optional": {
|
||||
"prev_motion_lora": ("MOTION_LORA",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 30}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MOTION_LORA",)
|
||||
|
||||
@@ -114,9 +114,6 @@ class ApplyAnimateDiffMotionCtrlModel:
|
||||
"prev_m_models": ("M_MODELS",),
|
||||
"per_block": ("PER_BLOCK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("M_MODELS",)
|
||||
|
||||
@@ -23,9 +23,6 @@ class MultivalDynamicNode:
|
||||
"optional": {
|
||||
"mask_optional": ("MASK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MULTIVAL",)
|
||||
@@ -48,9 +45,6 @@ class MultivalScaledMaskNode:
|
||||
"optional": {
|
||||
"scaling": (ScaleType.LIST,),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MULTIVAL",)
|
||||
@@ -96,9 +90,6 @@ class MultivalDynamicFloatInputNode:
|
||||
"optional": {
|
||||
"mask_optional": ("MASK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MULTIVAL",)
|
||||
@@ -119,9 +110,6 @@ class MultivalDynamicFloatsNode:
|
||||
"optional": {
|
||||
"mask_optional": ("MASK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MULTIVAL",)
|
||||
@@ -139,9 +127,6 @@ class MultivalFloatNode:
|
||||
"required": {
|
||||
"float_val": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001},),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MULTIVAL",)
|
||||
@@ -159,9 +144,6 @@ class MultivalConvertToMaskNode:
|
||||
"required": {
|
||||
"multival": ("MULTIVAL",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MASK",)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Union
|
||||
from torch import Tensor
|
||||
|
||||
from .documentation import short_desc, register_description, coll, DocHelper
|
||||
from .motion_module_ad import BlockType
|
||||
from .utils_model import ModelTypeSD
|
||||
from .utils_motion import AllPerBlocks, PerBlock, PerBlockId, extend_list_to_batch_size
|
||||
@@ -39,9 +38,6 @@ class ADBlockComboNode:
|
||||
"effect": ("MULTIVAL",),
|
||||
"scale": ("MULTIVAL",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AD_BLOCK",)
|
||||
@@ -68,7 +64,6 @@ class ADBlockIndivNode:
|
||||
"effect": ("MULTIVAL",),
|
||||
"scale_0": ("MULTIVAL",),
|
||||
"scale_1": ("MULTIVAL",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +92,6 @@ class PerBlockHighLevelNode:
|
||||
"down": ("AD_BLOCK",),
|
||||
"mid": ("AD_BLOCK",),
|
||||
"up": ("AD_BLOCK",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +135,6 @@ class PerBlock_SD15_MidLevelNode:
|
||||
"up_1": ("AD_BLOCK",),
|
||||
"up_2": ("AD_BLOCK",),
|
||||
"up_3": ("AD_BLOCK",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +202,6 @@ class PerBlock_SD15_LowLevelNode:
|
||||
"up_3__0": ("AD_BLOCK",),
|
||||
"up_3__1": ("AD_BLOCK",),
|
||||
"up_3__2": ("AD_BLOCK",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,24 +274,13 @@ class PerBlock_SD15_FromFloatsNode:
|
||||
"optional": {
|
||||
"effect_21_floats": ("FLOATS",),
|
||||
"scale_21_floats": ("FLOATS",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("PER_BLOCK",)
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/per block"
|
||||
FUNCTION = "create_per_block"
|
||||
|
||||
Desc = [
|
||||
short_desc('Use Floats from Value Schedules to select SD1.5 effect/scale values for blocks.'),
|
||||
'SD1.5 Motion Modules contain 21 blocks:',
|
||||
'idx 0 - start of down blocks (down_0__0)',
|
||||
'idx 7 - end of down blocks (down_3__1)',
|
||||
'idx 8 - mid block (mid)',
|
||||
'idx 9 - start of up blocks (up_0__0)',
|
||||
'idx 20 - end of up blocks (up_3__2)',
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Use Floats from Value Schedules to select SD1.5 effect/scale values for blocks.'
|
||||
|
||||
def create_per_block(self,
|
||||
effect_21_floats: Union[list[float], None]=None,
|
||||
@@ -336,7 +317,6 @@ class PerBlock_SDXL_MidLevelNode:
|
||||
"up_0": ("AD_BLOCK",),
|
||||
"up_1": ("AD_BLOCK",),
|
||||
"up_2": ("AD_BLOCK",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +375,6 @@ class PerBlock_SDXL_LowLevelNode:
|
||||
"up_2__0": ("AD_BLOCK",),
|
||||
"up_2__1": ("AD_BLOCK",),
|
||||
"up_2__2": ("AD_BLOCK",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,24 +437,13 @@ class PerBlock_SDXL_FromFloatsNode:
|
||||
"optional": {
|
||||
"effect_16_floats": ("FLOATS",),
|
||||
"scale_16_floats": ("FLOATS",),
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("PER_BLOCK",)
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/per block"
|
||||
FUNCTION = "create_per_block"
|
||||
|
||||
Desc = [
|
||||
short_desc('Use Floats from Value Schedules to select SDXL effect/scale values for blocks.'),
|
||||
'SDXL Motion Modules contain 16 blocks:',
|
||||
'idx 0 - start of down blocks (down_0__0)',
|
||||
'idx 5 - end of down blocks (down_2__1)',
|
||||
'idx 6 - mid block (mid)',
|
||||
'idx 7 - start of up blocks (up_0__0)',
|
||||
'idx 15 - end of up blocks (up_2__2)',
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Use Floats from Value Schedules to select SDXL effect/scale values for blocks.'
|
||||
|
||||
def create_per_block(self,
|
||||
effect_16_floats: Union[list[float], None]=None,
|
||||
|
||||
@@ -127,9 +127,6 @@ class ApplyAnimateDiffPIAModel:
|
||||
"prev_m_models": ("M_MODELS",),
|
||||
"per_block": ("PER_BLOCK",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("M_MODELS",)
|
||||
@@ -161,6 +158,7 @@ class ApplyAnimateDiffPIAModel:
|
||||
|
||||
|
||||
class LoadAnimateDiffAndInjectPIANode:
|
||||
EXPERIMENTAL = True
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -170,7 +168,6 @@ class LoadAnimateDiffAndInjectPIANode:
|
||||
},
|
||||
"optional": {
|
||||
"ad_settings": ("AD_SETTINGS",),
|
||||
"deprecation_warning": ("ADEWARN", {"text": "Experimental. Don't expect to work.", "warn_type": "experimental", "color": "#CFC"}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,9 +202,6 @@ class PIA_ADKeyframeNode:
|
||||
"inherit_missing": ("BOOLEAN", {"default": True}, ),
|
||||
"guarantee_steps": ("INT", {"default": 1, "min": 0, "max": BIGMAX}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AD_KEYFRAMES", )
|
||||
@@ -260,9 +254,6 @@ class InputPIA_PaperPresetsNode:
|
||||
"print_values": ("BOOLEAN", {"default": False},),
|
||||
#"effect_multival": ("MULTIVAL",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("PIA_INPUT",)
|
||||
|
||||
@@ -36,9 +36,6 @@ class SampleSettingsNode:
|
||||
"ancestral_opts": ("ANCESTRAL_OPTS",),
|
||||
#"noise_calib": ("NOISE_CALIBRATION",), # TODO: bring back once NoiseCalibration is working
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SAMPLE_SETTINGS",)
|
||||
@@ -71,9 +68,6 @@ class AncestralOptionsNode:
|
||||
"optional": {
|
||||
"seed_override": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("ANCESTRAL_OPTS",)
|
||||
@@ -101,9 +95,6 @@ class NoiseLayerReplaceNode:
|
||||
"mask_optional": ("MASK",),
|
||||
"seed_override": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NOISE_LAYERS",)
|
||||
@@ -139,9 +130,6 @@ class NoiseLayerAddNode:
|
||||
"mask_optional": ("MASK",),
|
||||
"seed_override": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NOISE_LAYERS",)
|
||||
@@ -180,9 +168,6 @@ class NoiseLayerAddWeightedNode:
|
||||
"mask_optional": ("MASK",),
|
||||
"seed_override": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NOISE_LAYERS",)
|
||||
@@ -220,9 +205,6 @@ class NoiseLayerNormalizedSumNode:
|
||||
"mask_optional": ("MASK",),
|
||||
"seed_override": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NOISE_LAYERS",)
|
||||
@@ -284,9 +266,6 @@ class FreeInitOptionsNode:
|
||||
"iter_batch_offset": ("INT", {"default": 0, "min": 0, "max": BIGMAX}),
|
||||
"iter_seed_offset": ("INT", {"default": 1, "min": BIGMIN, "max": BIGMAX}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("ITERATION_OPTS",)
|
||||
@@ -311,9 +290,6 @@ class NoiseCalibrationNode:
|
||||
"calib_iterations": ("INT", {"default": 1, "min": 1, "step": 1}),
|
||||
"thresh_freq": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("NOISE_CALIBRATION",)
|
||||
@@ -336,9 +312,6 @@ class CustomCFGNode:
|
||||
"optional": {
|
||||
"cfg_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CUSTOM_CFG",)
|
||||
@@ -362,9 +335,6 @@ class CustomCFGSimpleNode:
|
||||
"optional": {
|
||||
"cfg_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CUSTOM_CFG",)
|
||||
@@ -388,9 +358,6 @@ class CustomCFGKeyframeNode:
|
||||
"prev_custom_cfg": ("CUSTOM_CFG",),
|
||||
"cfg_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CUSTOM_CFG",)
|
||||
@@ -420,9 +387,6 @@ class CustomCFGKeyframeSimpleNode:
|
||||
"prev_custom_cfg": ("CUSTOM_CFG",),
|
||||
"cfg_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 10}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CUSTOM_CFG",)
|
||||
@@ -452,9 +416,6 @@ class CustomCFGKeyframeInterpolationNode:
|
||||
"prev_custom_cfg": ("CUSTOM_CFG",),
|
||||
"cfg_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CUSTOM_CFG",)
|
||||
@@ -541,9 +502,6 @@ class CFGExtrasPAGNode:
|
||||
"optional": {
|
||||
"prev_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CFG_EXTRAS",)
|
||||
@@ -575,9 +533,6 @@ class CFGExtrasPAGSimpleNode:
|
||||
"optional": {
|
||||
"prev_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CFG_EXTRAS",)
|
||||
@@ -630,9 +585,6 @@ class CFGExtrasRescaleCFGSimpleNode:
|
||||
"optional": {
|
||||
"prev_extras": ("CFG_EXTRAS",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 10}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CFG_EXTRAS",)
|
||||
@@ -662,9 +614,6 @@ class NoisedImageInjectionNode:
|
||||
"strength_multival": ("MULTIVAL", ),
|
||||
"prev_image_inject": ("IMAGE_INJECT", ),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE_INJECT",)
|
||||
@@ -694,9 +643,6 @@ class NoisedImageInjectOptionsNode:
|
||||
"composite_x": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}),
|
||||
"composite_y": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE_INJECT_OPTIONS",)
|
||||
|
||||
@@ -1,66 +1,10 @@
|
||||
from typing import Union
|
||||
|
||||
from .documentation import register_description, short_desc, coll, DocHelper
|
||||
from .scheduling import (evaluate_prompt_schedule, evaluate_value_schedule, extract_cond_from_schedule, TensorInterp, PromptOptions,
|
||||
verify_key_value)
|
||||
from .utils_model import BIGMAX
|
||||
from .logger import logger
|
||||
|
||||
|
||||
desc_values = {coll('values'): 'Write your values here.'}
|
||||
desc_prompts = {coll('prompts'): 'Write your prompts here.'}
|
||||
desc_clip = {'clip': 'CLIP to use for encoding prompts.'}
|
||||
desc_latent = {'latent': 'Used to get the amount of frames (max_length) to use for scheduling.'}
|
||||
|
||||
desc_prepend_text = {'prepend_text': 'OPTIONAL, adds text before all prompts.'}
|
||||
desc_append_text = {'append_text': 'OPTIONAL, adds text after all prompts.'}
|
||||
desc_values_replace = {'values_replace': 'OPTIONAL, replaces keys from value_replace keys with provided value schedules. Keys in the prompt are written as `some_key`, surrounded by the ` characters.'}
|
||||
desc_tensor_interp = {'tensor_interp': 'Selects method of interpolating prompt conds - defaults to lerp.'}
|
||||
desc_print_schedule = {'print_schedule': 'When True, prints output values for each frame.'}
|
||||
|
||||
desc_max_length = {'max_length': 'Used to select the intended length of schedule. If set to 0, will use the largest index in the schedule as max_length, but will disable relative indexes (negative and decimal).'}
|
||||
desc_floats = {'floats': 'List of floats, likely outputted by a Value Scheduling node.'}
|
||||
desc_FLOAT = {'FLOAT': 'Float (or list of floats) to convert to FLOATS type.'}
|
||||
desc_value_key = {'value_key': 'Key to use for value schedule in Prompt Scheduling node. Can only contain a-z, A-Z, 0-9, and _ characters. In Prompt Scheduling, keys can be referred to as `some_key`, where the key is surrounded by ` characters.'}
|
||||
desc_prev_replace = {'prev_replace': 'OPTIONAL, other values_replace can be chained.'}
|
||||
|
||||
desc_input_conditioning = {'conditioning': 'Encoded prompts. The output of a Prompt Scheduling node.'}
|
||||
desc_index = {'index': 'The index to extract. Must be within the range [0,N] where N is the length of scheduled prompts.'}
|
||||
desc_output_conditioning_single = {'CONDITIONING': 'The single step conditioning from the schedule.'}
|
||||
|
||||
desc_output_conditioning = {'CONDITIONING': 'Encoded prompts.'}
|
||||
desc_output_latent = {'LATENT': 'Unmodified input latents; can be used as pipe, or can be ignored.'}
|
||||
|
||||
desc_format_allowed_idxs = {'allowed idxs':
|
||||
{'single': 'A positive integer (e.g. 0, 2) schedules value for frame. A negative integer (e.g. -1, -5) schedules value for frame from the end (-1 would be the last frame). ' +
|
||||
'A decimal (e.g. 0.5, 1.0) selects frame based relative location in whole schedule (0.5 would be halfway, 1.0 would be last frame).',
|
||||
'range': 'Using rules above, single:single chooses uninterpolated prompts from start idx (included) to end idx (excluded). Examples -> 0:12, 0:-5, 2:0.5',
|
||||
'hold': 'Putting a colon after a single idx stops interpolation until the next provided index. Examples -> 0:, 0.5:, 16: '}
|
||||
}
|
||||
|
||||
desc_format_prompt = [
|
||||
'Scheduling supports two formats: JSON and pythonic.',
|
||||
{'JSON': ['"idx": "your prompt here", ...'],
|
||||
'pythonic': ['idx = "your prompt here", ...']},
|
||||
'The idx is the index of the frame - first frame is 0, last frame is max_frames-1. An idx may be the following:',
|
||||
desc_format_allowed_idxs,
|
||||
'The prompts themselves should be surrounded by double quotes ("your prompt here"). Portions of prompts can use value schedules provided values_replace.',
|
||||
{'JSON': ['"0": "blue rock on mountain",', '"16": "green rock in lake"'],
|
||||
'pythonic': ['0 = "blue rock on mountain",', '16 = "green rock in lake"']}
|
||||
]
|
||||
|
||||
desc_format_values = [
|
||||
'Scheduling supports two formats: JSON and pythonic.',
|
||||
{'JSON': ['"idx": float/int_value, ...'],
|
||||
'pythonic': ['idx = float/int_value, ...']},
|
||||
'The idx is the index of the frame - first frame is 0, last frame is max_frames-1. An idx may be the following:',
|
||||
desc_format_allowed_idxs,
|
||||
'The values can be written without any special formatting.',
|
||||
{'JSON': ['"0": 1.0,', '"16": 1.3'],
|
||||
'pythonic': ['0 = 1.0,', '16 = 1.3']}
|
||||
]
|
||||
|
||||
|
||||
class PromptSchedulingLatentsNode:
|
||||
NodeID = 'ADE_PromptSchedulingLatents'
|
||||
NodeName = 'Prompt Scheduling [Latents] 🎭🅐🅓'
|
||||
@@ -84,14 +28,7 @@ class PromptSchedulingLatentsNode:
|
||||
RETURN_TYPES = ("CONDITIONING", "LATENT",)
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/scheduling"
|
||||
FUNCTION = "create_schedule"
|
||||
|
||||
Desc = [
|
||||
short_desc('Encode a schedule of prompts with automatic interpolation, its length matching passed-in latent count.'),
|
||||
{'Format': desc_format_prompt},
|
||||
{coll('Inputs'): DocHelper.combine(desc_prompts, desc_clip, desc_latent, desc_values_replace, desc_prepend_text, desc_append_text, desc_tensor_interp, desc_print_schedule)},
|
||||
{coll('Outputs'): DocHelper.combine(desc_output_conditioning, desc_output_latent)}
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Encode a schedule of prompts with automatic interpolation, its length matching passed-in latent count.'
|
||||
|
||||
def create_schedule(self, prompts: str, clip, latent: dict, print_schedule=False, tensor_interp=TensorInterp.LERP,
|
||||
prepend_text='', append_text='', values_replace=None):
|
||||
@@ -124,14 +61,7 @@ class PromptSchedulingNode:
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/scheduling"
|
||||
FUNCTION = "create_schedule"
|
||||
|
||||
Desc = [
|
||||
short_desc('Encode a schedule of prompts with automatic interpolation.'),
|
||||
{'Format': desc_format_prompt},
|
||||
{coll('Inputs'): DocHelper.combine(desc_prompts, desc_clip, desc_values_replace, desc_prepend_text, desc_append_text, desc_max_length, desc_tensor_interp, desc_print_schedule)},
|
||||
{coll('Outputs'): DocHelper.combine(desc_output_conditioning)}
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Encode a schedule of prompts with automatic interpolation.'
|
||||
|
||||
def create_schedule(self, prompts: str, clip, print_schedule=False, max_length: int=0, tensor_interp=TensorInterp.LERP,
|
||||
prepend_text='', append_text='', values_replace=None):
|
||||
@@ -154,21 +84,12 @@ class ValueSchedulingLatentsNode:
|
||||
"optional": {
|
||||
"print_schedule": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("FLOAT", "FLOATS", "INT", "INTS")
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/scheduling"
|
||||
FUNCTION = "create_schedule"
|
||||
|
||||
Desc = [
|
||||
short_desc('Create a list of values with automatic interpolation, its length matching passed-in latent count.'),
|
||||
{'Format': desc_format_values},
|
||||
{coll('Inputs'): DocHelper.combine(desc_values, desc_latent, desc_print_schedule)},
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Create a list of values with automatic interpolation, its length matching passed-in latent count.'
|
||||
|
||||
def create_schedule(self, values: str, latent: dict, print_schedule=False):
|
||||
float_vals = evaluate_value_schedule(values, latent["samples"].size(0))
|
||||
@@ -193,21 +114,12 @@ class ValueSchedulingNode:
|
||||
"print_schedule": ("BOOLEAN", {"default": False}),
|
||||
"max_length": ("INT", {"default": 0, "min": 0, "max": BIGMAX, "step": 1}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("FLOAT", "FLOATS", "INT", "INTS")
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/scheduling"
|
||||
FUNCTION = "create_schedule"
|
||||
|
||||
Desc = [
|
||||
short_desc('Create a list of values with automatic interpolation.'),
|
||||
{'Format': desc_format_values},
|
||||
{coll('Inputs'): DocHelper.combine(desc_values, desc_max_length, desc_print_schedule)},
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Create a list of values with automatic interpolation.'
|
||||
|
||||
def create_schedule(self, values: str, max_length: int, print_schedule=False):
|
||||
float_vals = evaluate_value_schedule(values, max_length)
|
||||
@@ -232,20 +144,12 @@ class AddValuesReplaceNode:
|
||||
"optional": {
|
||||
"prev_replace": ("VALUES_REPLACE",),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("VALUES_REPLACE",)
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/scheduling"
|
||||
FUNCTION = "add_values_replace"
|
||||
|
||||
Desc = [
|
||||
short_desc('Add a values schedule bound to a key to be used in Prompt Scheduling node.'),
|
||||
{'Inputs': DocHelper.combine(desc_value_key, desc_floats, desc_prev_replace)},
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Add a values schedule bound to a key to be used in Prompt Scheduling node.'
|
||||
|
||||
def add_values_replace(self, value_key: str, floats: Union[list[float]], prev_replace: dict=None):
|
||||
# key can only have a-z, A-Z, 0-9, and _ characters
|
||||
@@ -269,9 +173,6 @@ class FloatToFloatsNode:
|
||||
"required": {
|
||||
"FLOAT": ("FLOAT", {"default": 39, "forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("FLOATS",)
|
||||
@@ -301,13 +202,7 @@ class ConditionExtractionNode:
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
CATEGORY = "Animate Diff 🎭🅐🅓/scheduling"
|
||||
FUNCTION = "extract_conditioning"
|
||||
|
||||
Desc = [
|
||||
short_desc('Extract a single conditioning step from a schedule of prompts.'),
|
||||
{coll('Inputs'): DocHelper.combine(desc_input_conditioning, desc_index)},
|
||||
{coll('Outputs'): DocHelper.combine(desc_output_conditioning)}
|
||||
]
|
||||
register_description(NodeID, Desc)
|
||||
DESCRIPTION = 'Extract a single conditioning step from a schedule of prompts.'
|
||||
|
||||
def extract_conditioning(self, conditioning, index: int=0):
|
||||
conditioning_step = extract_cond_from_schedule(conditioning, index)
|
||||
|
||||
@@ -46,9 +46,6 @@ class RawSigmaScheduleNode:
|
||||
"lcm_original_timesteps": ("INT", {"default": 50, "min": 1, "max": 1000}),
|
||||
"zsnr": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SIGMA_SCHEDULE",)
|
||||
@@ -83,9 +80,6 @@ class WeightedAverageSigmaScheduleNode:
|
||||
"schedule_B": ("SIGMA_SCHEDULE",),
|
||||
"weight_A": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SIGMA_SCHEDULE",)
|
||||
@@ -111,9 +105,6 @@ class InterpolatedWeightedAverageSigmaScheduleNode:
|
||||
"weight_A_End": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.001}),
|
||||
"interpolation": (InterpolationMethod._LIST,),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SIGMA_SCHEDULE",)
|
||||
@@ -142,9 +133,6 @@ class SplitAndCombineSigmaScheduleNode:
|
||||
"schedule_End": ("SIGMA_SCHEDULE",),
|
||||
"idx_split_percent": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.001})
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SIGMA_SCHEDULE",)
|
||||
@@ -171,9 +159,6 @@ class SigmaScheduleToSigmasNode:
|
||||
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
|
||||
"denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
},
|
||||
"hidden": {
|
||||
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SIGMAS",)
|
||||
|
||||
+4
-18
@@ -203,10 +203,13 @@ def groupnorm_mm_factory(params: InjectionParams, manual_cast=False):
|
||||
|
||||
input = rearrange(input, "(b f) c h w -> b c f h w", b=batched_conds)
|
||||
if manual_cast:
|
||||
weight, bias = comfy.ops.cast_bias_weight(self, input)
|
||||
weight, bias, offload_stream = comfy.ops.cast_bias_weight(self, input, offloadable=True)
|
||||
else:
|
||||
weight, bias = self.weight, self.bias
|
||||
offload_stream = None
|
||||
input = group_norm(input, self.num_groups, weight, bias, self.eps)
|
||||
if offload_stream is not None:
|
||||
comfy.ops.uncast_bias_weight(self, weight, bias, offload_stream)
|
||||
input = rearrange(input, "b c f h w -> (b f) c h w", b=batched_conds)
|
||||
return input
|
||||
return groupnorm_mm_forward
|
||||
@@ -754,23 +757,6 @@ def get_resized_cond(cond_in, x_in: Tensor, full_idxs: list[int], context_length
|
||||
def sliding_calc_cond_batch(executor: Callable, model, conds: list[list[dict]], x_in: Tensor, timestep, model_options):
|
||||
ADGS: AnimateDiffGlobalState = model_options["transformer_options"]["ADGS"]
|
||||
if not ADGS.is_using_sliding_context():
|
||||
if model_options["transformer_options"].get("context_window", None) is not None:
|
||||
window = model_options["transformer_options"]["context_window"]
|
||||
model_options["transformer_options"]["ad_params"]["sub_idxs"] = window.index_list
|
||||
model_options["transformer_options"]["ad_params"]["context_length"] = len(window.index_list)
|
||||
device = None
|
||||
if device is None:
|
||||
motion_models_devices = ADGS.motion_models_devices.values()
|
||||
else:
|
||||
motion_models_devices = ADGS.motion_models_devices.get(device, None)
|
||||
if motion_models_devices is None:
|
||||
motion_models_devices = []
|
||||
else:
|
||||
motion_models_devices = [motion_models_devices]
|
||||
model = ADGS.model_patcher_devices[device].model
|
||||
for motion_models in motion_models_devices:
|
||||
motion_models.set_sub_idxs(window.index_list)
|
||||
motion_models.set_video_length(len(window.index_list), ADGS.params.full_length)
|
||||
return executor(model, conds, x_in, timestep, model_options)
|
||||
|
||||
# get context windows
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-animatediff-evolved"
|
||||
description = "Improved AnimateDiff integration for ComfyUI."
|
||||
version = "1.5.6"
|
||||
version = "1.5.7"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = []
|
||||
|
||||
@@ -13,3 +13,4 @@ Repository = "https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved"
|
||||
PublisherId = "kosinkadink"
|
||||
DisplayName = "ComfyUI-AnimateDiff-Evolved"
|
||||
Icon = ""
|
||||
requires-comfyui = ">=0.3.68"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Condition Step Extraction
|
||||
|
||||
Extract a single conditioning step from a schedule of prompts.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `conditioning`: Encoded prompts from a Prompt Scheduling node.
|
||||
- `index`: The step to extract. It must be within the scheduled prompt range.
|
||||
|
||||
## Outputs
|
||||
|
||||
- `CONDITIONING`: The single conditioning step from the schedule.
|
||||
@@ -0,0 +1,24 @@
|
||||
# AD Per Block Floats (SD1.5)
|
||||
|
||||
Use Floats from Value Schedules to select SD1.5 effect and scale values for blocks.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `effect_21_floats`: Optional effect values. The list is extended to the required 21 values when needed.
|
||||
- `scale_21_floats`: Optional scale values. The list is extended to the required 21 values when needed.
|
||||
|
||||
## Block index map
|
||||
|
||||
SD1.5 motion modules contain 21 blocks.
|
||||
|
||||
| Index | Block |
|
||||
| ---: | --- |
|
||||
| 0 | Start of down blocks (`down_0__0`) |
|
||||
| 7 | End of down blocks (`down_3__1`) |
|
||||
| 8 | Mid block (`mid`) |
|
||||
| 9 | Start of up blocks (`up_0__0`) |
|
||||
| 20 | End of up blocks (`up_3__2`) |
|
||||
|
||||
## Outputs
|
||||
|
||||
- `PER_BLOCK`: Per-block effect and scale configuration for an SD1.5 motion module.
|
||||
@@ -0,0 +1,24 @@
|
||||
# AD Per Block Floats (SDXL)
|
||||
|
||||
Use Floats from Value Schedules to select SDXL effect and scale values for blocks.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `effect_16_floats`: Optional effect values. The list is extended to the required 16 values when needed.
|
||||
- `scale_16_floats`: Optional scale values. The list is extended to the required 16 values when needed.
|
||||
|
||||
## Block index map
|
||||
|
||||
SDXL motion modules contain 16 blocks.
|
||||
|
||||
| Index | Block |
|
||||
| ---: | --- |
|
||||
| 0 | Start of down blocks (`down_0__0`) |
|
||||
| 5 | End of down blocks (`down_2__1`) |
|
||||
| 6 | Mid block (`mid`) |
|
||||
| 7 | Start of up blocks (`up_0__0`) |
|
||||
| 15 | End of up blocks (`up_2__2`) |
|
||||
|
||||
## Outputs
|
||||
|
||||
- `PER_BLOCK`: Per-block effect and scale configuration for an SDXL motion module.
|
||||
@@ -0,0 +1,42 @@
|
||||
# Prompt Scheduling
|
||||
|
||||
Encode a schedule of prompts with automatic interpolation.
|
||||
|
||||
## Schedule format
|
||||
|
||||
Schedules support JSON and Python-like formats. Frame 0 is the first frame and `max_frames - 1` is the last.
|
||||
|
||||
```text
|
||||
"0": "blue rock on mountain",
|
||||
"16": "green rock in lake"
|
||||
```
|
||||
|
||||
```text
|
||||
0 = "blue rock on mountain",
|
||||
16 = "green rock in lake"
|
||||
```
|
||||
|
||||
Prompts must be enclosed in double quotes. Prompt portions may use keys supplied through `values_replace`.
|
||||
|
||||
### Allowed indices
|
||||
|
||||
- **Single:** A positive integer such as `0` or `2` selects that frame. A negative integer such as `-1` or `-5` selects from the end (`-1` is the last frame). A decimal such as `0.5` or `1.0` selects a relative position (`0.5` is halfway and `1.0` is the last frame).
|
||||
- **Range:** `start:end` uses an uninterpolated prompt from the included start index to the excluded end index. Examples: `0:12`, `0:-5`, `2:0.5`.
|
||||
- **Hold:** A colon after one index stops interpolation until the next supplied index. Examples: `0:`, `0.5:`, `16:`.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description |
|
||||
| --- | --- |
|
||||
| `prompts` | The prompt schedule. |
|
||||
| `clip` | CLIP used to encode prompts. |
|
||||
| `prepend_text` | Optional text added before every prompt. |
|
||||
| `append_text` | Optional text added after every prompt. |
|
||||
| `values_replace` | Optional value schedules substituted for keys written as `` `some_key` `` in prompts. |
|
||||
| `print_schedule` | Print the resulting schedule when enabled. |
|
||||
| `max_length` | Intended schedule length. At 0, the largest schedule index determines the length, but negative and decimal relative indices are disabled. |
|
||||
| `tensor_interp` | Prompt-conditioning interpolation method; defaults to linear interpolation. |
|
||||
|
||||
## Outputs
|
||||
|
||||
- `CONDITIONING`: Encoded prompts.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Prompt Scheduling [Latents]
|
||||
|
||||
Encode a schedule of prompts with automatic interpolation, its length matching the passed-in latent count.
|
||||
|
||||
## Schedule format
|
||||
|
||||
Schedules support JSON and Python-like formats. Frame 0 is the first frame and `max_frames - 1` is the last.
|
||||
|
||||
```text
|
||||
"0": "blue rock on mountain",
|
||||
"16": "green rock in lake"
|
||||
```
|
||||
|
||||
```text
|
||||
0 = "blue rock on mountain",
|
||||
16 = "green rock in lake"
|
||||
```
|
||||
|
||||
Prompts must be enclosed in double quotes. Prompt portions may use keys supplied through `values_replace`.
|
||||
|
||||
### Allowed indices
|
||||
|
||||
- **Single:** A positive integer such as `0` or `2` selects that frame. A negative integer such as `-1` or `-5` selects from the end (`-1` is the last frame). A decimal such as `0.5` or `1.0` selects a relative position (`0.5` is halfway and `1.0` is the last frame).
|
||||
- **Range:** `start:end` uses an uninterpolated prompt from the included start index to the excluded end index. Examples: `0:12`, `0:-5`, `2:0.5`.
|
||||
- **Hold:** A colon after one index stops interpolation until the next supplied index. Examples: `0:`, `0.5:`, `16:`.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description |
|
||||
| --- | --- |
|
||||
| `prompts` | The prompt schedule. |
|
||||
| `clip` | CLIP used to encode prompts. |
|
||||
| `latent` | Supplies the frame count used as the schedule length. |
|
||||
| `prepend_text` | Optional text added before every prompt. |
|
||||
| `append_text` | Optional text added after every prompt. |
|
||||
| `values_replace` | Optional value schedules substituted for keys written as `` `some_key` `` in prompts. |
|
||||
| `tensor_interp` | Prompt-conditioning interpolation method; defaults to linear interpolation. |
|
||||
| `print_schedule` | Print the resulting schedule when enabled. |
|
||||
|
||||
## Outputs
|
||||
|
||||
- `CONDITIONING`: Encoded prompts.
|
||||
- `LATENT`: The unmodified input latents, usable as a pipe or safely ignored.
|
||||
@@ -0,0 +1,33 @@
|
||||
# Value Scheduling
|
||||
|
||||
Create a list of values with automatic interpolation.
|
||||
|
||||
## Schedule format
|
||||
|
||||
Schedules support JSON and Python-like formats. Values need no special formatting.
|
||||
|
||||
```text
|
||||
"0": 1.0,
|
||||
"16": 1.3
|
||||
```
|
||||
|
||||
```text
|
||||
0 = 1.0,
|
||||
16 = 1.3
|
||||
```
|
||||
|
||||
Frame 0 is the first frame and `max_frames - 1` is the last.
|
||||
|
||||
- **Single:** Positive integers select a frame, negative integers select from the end (`-1` is last), and decimals select a relative position (`0.5` is halfway and `1.0` is last).
|
||||
- **Range:** `start:end` holds the start value without interpolation through the excluded end. Examples: `0:12`, `0:-5`, `2:0.5`.
|
||||
- **Hold:** A trailing colon stops interpolation until the next index. Examples: `0:`, `0.5:`, `16:`.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `values`: The value schedule.
|
||||
- `max_length`: Intended schedule length. At 0, the largest schedule index determines the length, but negative and decimal relative indices are disabled.
|
||||
- `print_schedule`: Print each output value when enabled.
|
||||
|
||||
## Outputs
|
||||
|
||||
The schedule is returned as `FLOAT`, `FLOATS`, rounded `INT`, and rounded `INTS` outputs.
|
||||
@@ -0,0 +1,33 @@
|
||||
# Value Scheduling [Latents]
|
||||
|
||||
Create a list of values with automatic interpolation, its length matching the passed-in latent count.
|
||||
|
||||
## Schedule format
|
||||
|
||||
Schedules support JSON and Python-like formats. Values need no special formatting.
|
||||
|
||||
```text
|
||||
"0": 1.0,
|
||||
"16": 1.3
|
||||
```
|
||||
|
||||
```text
|
||||
0 = 1.0,
|
||||
16 = 1.3
|
||||
```
|
||||
|
||||
Frame 0 is the first frame and `max_frames - 1` is the last.
|
||||
|
||||
- **Single:** Positive integers select a frame, negative integers select from the end (`-1` is last), and decimals select a relative position (`0.5` is halfway and `1.0` is last).
|
||||
- **Range:** `start:end` holds the start value without interpolation through the excluded end. Examples: `0:12`, `0:-5`, `2:0.5`.
|
||||
- **Hold:** A trailing colon stops interpolation until the next index. Examples: `0:`, `0.5:`, `16:`.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `values`: The value schedule.
|
||||
- `latent`: Supplies the frame count used as the schedule length.
|
||||
- `print_schedule`: Print each output value when enabled.
|
||||
|
||||
## Outputs
|
||||
|
||||
The schedule is returned as `FLOAT`, `FLOATS`, rounded `INT`, and rounded `INTS` outputs.
|
||||
@@ -0,0 +1,13 @@
|
||||
# Add Values Replace
|
||||
|
||||
Add a value schedule bound to a key for use in a Prompt Scheduling node.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `value_key`: The key for the value schedule. It may contain only `a-z`, `A-Z`, `0-9`, and `_`. Refer to it in a prompt by surrounding it with backticks, for example `` `some_key` ``.
|
||||
- `floats`: A list of floats, typically produced by a Value Scheduling node.
|
||||
- `prev_replace`: Optional existing replacements, allowing multiple Values Replace nodes to be chained.
|
||||
|
||||
## Outputs
|
||||
|
||||
- `VALUES_REPLACE`: The replacement mapping for a Prompt Scheduling node.
|
||||
@@ -1,53 +0,0 @@
|
||||
import { app } from '../../../scripts/app.js'
|
||||
|
||||
function addResizeHook(node, padding, useOldMin=false) {
|
||||
let origOnCreated = node.onNodeCreated
|
||||
node.onNodeCreated = function() {
|
||||
let r = origOnCreated?.apply(this, arguments)
|
||||
let size = this.computeSize();
|
||||
size[0] += padding || 0;
|
||||
if (useOldMin) {
|
||||
//equal to LiteGraph.NODE_WIDTH*1.5*1.5
|
||||
size[0] = Math.max(size[0], 315)
|
||||
}
|
||||
this.setSize(size);
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
app.registerExtension({
|
||||
name: "AnimateDiffEvolved.autosize",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
//since python_module is based off folder path,
|
||||
//it could be changed by users and should only be used as fallback
|
||||
if (nodeData?.name?.startsWith("ADE_")
|
||||
|| nodeData.python_module == 'custom_nodes.ComfyUI-AnimateDiff-Evolved') {
|
||||
if (nodeData?.input?.hidden?.autosize) {
|
||||
addResizeHook(nodeType.prototype, nodeData.input.hidden.autosize[1]?.padding)
|
||||
} else if (!nodeData?.input?.optional?.autosize) {
|
||||
addResizeHook(nodeType.prototype, 0, true)
|
||||
}
|
||||
}
|
||||
},
|
||||
async getCustomWidgets() {
|
||||
return {
|
||||
ADEAUTOSIZE(node, inputName, inputData) {
|
||||
let w = {
|
||||
name : inputName,
|
||||
type : "ADE.AUTOSIZE",
|
||||
value : "",
|
||||
options : {"serialize": false},
|
||||
computeSize : function(width) {
|
||||
return [0, -4];
|
||||
}
|
||||
}
|
||||
if (!node.widgets) {
|
||||
node.widgets = []
|
||||
}
|
||||
node.widgets.push(w)
|
||||
addResizeHook(node, inputData[1].padding);
|
||||
return w;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,51 +0,0 @@
|
||||
import { app } from '../../../scripts/app.js'
|
||||
|
||||
const deprecate_nodes = {
|
||||
name: 'AnimateDiff.deprecate_nodes',
|
||||
async getCustomWidgets() {
|
||||
return {
|
||||
ADEWARN(node, inputName, inputData) {
|
||||
let w = {
|
||||
name : inputName,
|
||||
type : "ADE.WARN",
|
||||
value : "",
|
||||
draw : function(ctx, node, widget_width, y, H) {
|
||||
var show_text = app.canvas.ds.scale > 0.5;
|
||||
var margin = 15;
|
||||
var text_color = inputData[1]['color'] || "#FCC"
|
||||
ctx.textAlign = "center";
|
||||
if (show_text) {
|
||||
if(!this.disabled)
|
||||
ctx.stroke();
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.rect(margin, y, widget_width - margin * 2, H);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = text_color;
|
||||
let disp_text = inputData[1]['text']
|
||||
ctx.fillText(disp_text, widget_width/2, y + H * 0.7);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
},
|
||||
options : {"serialize": false},
|
||||
computeSize : function(width) {
|
||||
if (inputData[1]['text']) {
|
||||
return [width, 20]
|
||||
}
|
||||
return [0, -4]
|
||||
|
||||
}
|
||||
}
|
||||
if (!node.widgets) {
|
||||
node.widgets = []
|
||||
}
|
||||
node.widgets.push(w)
|
||||
return w
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.registerExtension(deprecate_nodes)
|
||||
|
||||
@@ -1,292 +0,0 @@
|
||||
import { app } from '../../../scripts/app.js'
|
||||
|
||||
function chainCallback(object, property, callback) {
|
||||
if (object == undefined) {
|
||||
//This should not happen.
|
||||
console.error("Tried to add callback to non-existant object")
|
||||
return;
|
||||
}
|
||||
if (property in object && object[property]) {
|
||||
const callback_orig = object[property]
|
||||
object[property] = function () {
|
||||
const r = callback_orig.apply(this, arguments);
|
||||
callback.apply(this, arguments);
|
||||
return r
|
||||
};
|
||||
} else {
|
||||
object[property] = callback;
|
||||
}
|
||||
}
|
||||
var helpDOM;
|
||||
function initHelpDOM() {
|
||||
let parentDOM = document.createElement("div");
|
||||
document.body.appendChild(parentDOM)
|
||||
parentDOM.appendChild(helpDOM)
|
||||
helpDOM.className = "litegraph";
|
||||
let scrollbarStyle = document.createElement('style');
|
||||
parentDOM.className = "VHS_floatinghelp"
|
||||
scrollbarStyle.innerHTML = `
|
||||
.VHS_floatinghelp {
|
||||
scrollbar-width: 6px;
|
||||
scrollbar-color: #0003 #0000;
|
||||
&::-webkit-scrollbar {
|
||||
background: transparent;
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #0005;
|
||||
border-radius: 20px
|
||||
}
|
||||
&::-webkit-scrollbar-button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.VHS_loopedvideo::-webkit-media-controls-mute-button {
|
||||
display:none;
|
||||
}
|
||||
.VHS_loopedvideo::-webkit-media-controls-fullscreen-button {
|
||||
display:none;
|
||||
}
|
||||
`
|
||||
parentDOM.appendChild(scrollbarStyle)
|
||||
chainCallback(app.canvas, "onDrawForeground", function (ctx, visible_rect){
|
||||
let n = helpDOM.node
|
||||
if (!n || !n?.graph) {
|
||||
parentDOM.style['left'] = '-5000px'
|
||||
return
|
||||
}
|
||||
//draw : function(ctx, node, widgetWidth, widgetY, height) {
|
||||
//update widget position, even if off screen
|
||||
const transform = ctx.getTransform();
|
||||
const scale = app.canvas.ds.scale;//gets the litegraph zoom
|
||||
//calculate coordinates with account for browser zoom
|
||||
const bcr = app.canvas.canvas.getBoundingClientRect()
|
||||
const x = transform.e*scale/transform.a + bcr.x;
|
||||
const y = transform.f*scale/transform.a + bcr.y;
|
||||
//TODO: text reflows at low zoom. investigate alternatives
|
||||
Object.assign(parentDOM.style, {
|
||||
left: (x+(n.pos[0] + n.size[0]+15)*scale) + "px",
|
||||
top: (y+(n.pos[1]-LiteGraph.NODE_TITLE_HEIGHT)*scale) + "px",
|
||||
width: "400px",
|
||||
minHeight: "100px",
|
||||
maxHeight: "600px",
|
||||
overflowY: 'scroll',
|
||||
transformOrigin: '0 0',
|
||||
transform: 'scale(' + scale + ',' + scale +')',
|
||||
fontSize: '18px',
|
||||
backgroundColor: LiteGraph.NODE_DEFAULT_BGCOLOR,
|
||||
boxShadow: '0 0 10px black',
|
||||
borderRadius: '4px',
|
||||
padding: '3px',
|
||||
zIndex: 3,
|
||||
position: "absolute",
|
||||
display: 'inline',
|
||||
});
|
||||
});
|
||||
function setCollapse(el, doCollapse) {
|
||||
if (doCollapse) {
|
||||
el.children[0].children[0].innerHTML = '+'
|
||||
Object.assign(el.children[1].style, {
|
||||
color: '#CCC',
|
||||
overflowX: 'hidden',
|
||||
width: '0px',
|
||||
minWidth: 'calc(100% - 20px)',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
})
|
||||
for (let child of el.children[1].children) {
|
||||
if (child.style.display != 'none'){
|
||||
child.origDisplay = child.style.display
|
||||
}
|
||||
child.style.display = 'none'
|
||||
}
|
||||
} else {
|
||||
el.children[0].children[0].innerHTML = '-'
|
||||
Object.assign(el.children[1].style, {
|
||||
color: '',
|
||||
overflowX: '',
|
||||
width: '100%',
|
||||
minWidth: '',
|
||||
textOverflow: '',
|
||||
whiteSpace: '',
|
||||
})
|
||||
for (let child of el.children[1].children) {
|
||||
child.style.display = child.origDisplay
|
||||
}
|
||||
}
|
||||
}
|
||||
helpDOM.collapseOnClick = function() {
|
||||
let doCollapse = this.children[0].innerHTML == '-'
|
||||
setCollapse(this.parentElement, doCollapse)
|
||||
}
|
||||
helpDOM.selectHelp = function(name, value) {
|
||||
//attempt to navigate to name in help
|
||||
function collapseUnlessMatch(items,t) {
|
||||
var match = items.querySelector('[vhs_title="' + t + '"]')
|
||||
if (!match) {
|
||||
for (let i of items.children) {
|
||||
if (i.innerHTML.slice(0,t.length+5).includes(t)) {
|
||||
match = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
return null
|
||||
}
|
||||
//For longer documentation items with fewer collapsable elements,
|
||||
//scroll to make sure the entirety of the selected item is visible
|
||||
//This has the unfortunate side effect of trying to scroll the main
|
||||
//window if the documentation windows is forcibly offscreen,
|
||||
//but it's easy to simply scroll the main window back and seems to
|
||||
//have no visual side effects
|
||||
match.scrollIntoView(false)
|
||||
window.scrollTo(0,0)
|
||||
for (let i of items.querySelectorAll('.VHS_collapse')) {
|
||||
if (i.contains(match)) {
|
||||
setCollapse(i, false)
|
||||
} else {
|
||||
setCollapse(i, true)
|
||||
}
|
||||
}
|
||||
return match
|
||||
}
|
||||
let target = collapseUnlessMatch(helpDOM, name)
|
||||
if (target && value) {
|
||||
collapseUnlessMatch(target, value)
|
||||
}
|
||||
}
|
||||
|
||||
helpDOM.addHelp = function(node, nodeType, description) {
|
||||
if (!description) {
|
||||
return
|
||||
}
|
||||
//Pad computed size for the clickable question mark
|
||||
let originalComputeSize = node.computeSize
|
||||
node.computeSize = function() {
|
||||
let size = originalComputeSize.apply(this, arguments)
|
||||
if (!this.title) {
|
||||
return size
|
||||
}
|
||||
let title_width = this.title.length * 0.6 * LiteGraph.NODE_TEXT_SIZE
|
||||
size[0] = Math.max(size[0], title_width + LiteGraph.NODE_TITLE_HEIGHT)
|
||||
return size
|
||||
}
|
||||
|
||||
node.description = description
|
||||
chainCallback(node, "onDrawForeground", function (ctx) {
|
||||
//draw question mark
|
||||
ctx.save()
|
||||
ctx.font = 'bold 20px Arial'
|
||||
ctx.fillText("?", this.size[0]-17, -8)
|
||||
ctx.restore()
|
||||
})
|
||||
chainCallback(node, "onMouseDown", function (e, pos, canvas) {
|
||||
//On click would be preferred, but this'll be good enough
|
||||
if (pos[1] < 0 && pos[0] + LiteGraph.NODE_TITLE_HEIGHT > this.size[0]) {
|
||||
//corner question mark clicked
|
||||
if (helpDOM.node == this) {
|
||||
helpDOM.node = undefined
|
||||
} else {
|
||||
helpDOM.node = this;
|
||||
helpDOM.innerHTML = this.description || "no help provided ".repeat(20)
|
||||
for (let e of helpDOM.querySelectorAll('.VHS_collapse')) {
|
||||
e.children[0].onclick = helpDOM.collapseOnClick
|
||||
e.children[0].style.cursor = 'pointer'
|
||||
}
|
||||
for (let e of helpDOM.querySelectorAll('.VHS_precollapse')) {
|
||||
setCollapse(e, true)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
let timeout = null
|
||||
chainCallback(node, "onMouseMove", function (e, pos, canvas) {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout)
|
||||
timeout = null
|
||||
}
|
||||
if (helpDOM.node != this) {
|
||||
return
|
||||
}
|
||||
timeout = setTimeout(() => {
|
||||
let n = this
|
||||
if (pos[0] > 0 && pos[0] < n.size[0]
|
||||
&& pos[1] > 0 && pos[1] < n.size[1]) {
|
||||
//TODO: provide help specific to element clicked
|
||||
let inputRows = Math.max(n.inputs.length, n.outputs.length)
|
||||
if (pos[1] < LiteGraph.NODE_SLOT_HEIGHT * inputRows) {
|
||||
let row = Math.floor((pos[1] - 7) / LiteGraph.NODE_SLOT_HEIGHT)
|
||||
if (pos[0] < n.size[0]/2) {
|
||||
if (row < n.inputs.length) {
|
||||
helpDOM.selectHelp(n.inputs[row].name)
|
||||
}
|
||||
} else {
|
||||
if (row < n.outputs.length) {
|
||||
helpDOM.selectHelp(n.outputs[row].name)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//probably widget, but widgets have variable height.
|
||||
let basey = LiteGraph.NODE_SLOT_HEIGHT * inputRows + 6
|
||||
for (let w of n.widgets) {
|
||||
if (w.y) {
|
||||
basey = w.y
|
||||
}
|
||||
let wheight = LiteGraph.NODE_WIDGET_HEIGHT+4
|
||||
if (w.computeSize) {
|
||||
wheight = w.computeSize(n.size[0])[1]
|
||||
}
|
||||
if (pos[1] < basey + wheight) {
|
||||
helpDOM.selectHelp(w.name, w.value)
|
||||
break
|
||||
}
|
||||
basey += wheight
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 500)
|
||||
})
|
||||
chainCallback(node, "onMouseLeave", function (e, pos, canvas) {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout)
|
||||
timeout = null
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
app.registerExtension({
|
||||
name: "AnimateDiffEvolved.documentation",
|
||||
async init() {
|
||||
if (app.VHSHelp) {
|
||||
helpDOM = app.VHSHelp
|
||||
} else {
|
||||
helpDOM = document.createElement("div");
|
||||
initHelpDOM()
|
||||
app.VHSHelp = helpDOM
|
||||
}
|
||||
},
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
// NOTE: May need manual adjusting for the few non-namespaced nodes
|
||||
if(nodeData?.name?.startsWith("ADE_") && nodeData.description) {
|
||||
let description = nodeData.description
|
||||
let el = document.createElement("div")
|
||||
el.innerHTML = description
|
||||
if (!el.children.length) {
|
||||
//Is plaintext. Do minor convenience formatting
|
||||
let chunks = description.split('\n')
|
||||
nodeData.description = chunks[0]
|
||||
description = chunks.join('<br>')
|
||||
} else {
|
||||
nodeData.description = el.querySelector('#VHS_shortdesc')?.innerHTML || el.children[1]?.firstChild?.innerHTML
|
||||
}
|
||||
chainCallback(nodeType.prototype, "onNodeCreated", function () {
|
||||
helpDOM.addHelp(this, nodeType, description)
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,142 +0,0 @@
|
||||
import { app } from '../../../scripts/app.js'
|
||||
import { api } from '../../../scripts/api.js'
|
||||
|
||||
function offsetDOMWidget(
|
||||
widget,
|
||||
ctx,
|
||||
node,
|
||||
widgetWidth,
|
||||
widgetY,
|
||||
height
|
||||
) {
|
||||
const margin = 10
|
||||
const elRect = ctx.canvas.getBoundingClientRect()
|
||||
const transform = new DOMMatrix()
|
||||
.scaleSelf(
|
||||
elRect.width / ctx.canvas.width,
|
||||
elRect.height / ctx.canvas.height
|
||||
)
|
||||
.multiplySelf(ctx.getTransform())
|
||||
.translateSelf(0, widgetY + margin)
|
||||
|
||||
const scale = new DOMMatrix().scaleSelf(transform.a, transform.d)
|
||||
Object.assign(widget.inputEl.style, {
|
||||
transformOrigin: '0 0',
|
||||
transform: scale,
|
||||
left: `${transform.e}px`,
|
||||
top: `${transform.d + transform.f}px`,
|
||||
width: `${widgetWidth}px`,
|
||||
height: `${(height || widget.parent?.inputHeight || 32) - margin}px`,
|
||||
position: 'absolute',
|
||||
background: !node.color ? '' : node.color,
|
||||
color: !node.color ? '' : 'white',
|
||||
zIndex: 5, //app.graph._nodes.indexOf(node),
|
||||
})
|
||||
}
|
||||
|
||||
export const hasWidgets = (node) => {
|
||||
if (!node.widgets || !node.widgets?.[Symbol.iterator]) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
export const cleanupNode = (node) => {
|
||||
if (!hasWidgets(node)) {
|
||||
return
|
||||
}
|
||||
|
||||
for (const w of node.widgets) {
|
||||
if (w.canvas) {
|
||||
w.canvas.remove()
|
||||
}
|
||||
if (w.inputEl) {
|
||||
w.inputEl.remove()
|
||||
}
|
||||
// calls the widget remove callback
|
||||
w.onRemoved?.()
|
||||
}
|
||||
}
|
||||
|
||||
const CreatePreviewElement = (name, val, format) => {
|
||||
const [type] = format.split('/')
|
||||
const w = {
|
||||
name,
|
||||
type,
|
||||
value: val,
|
||||
draw: function (ctx, node, widgetWidth, widgetY, height) {
|
||||
const [cw, ch] = this.computeSize(widgetWidth)
|
||||
offsetDOMWidget(this, ctx, node, widgetWidth, widgetY, ch)
|
||||
},
|
||||
computeSize: function (_) {
|
||||
const ratio = this.inputRatio || 1
|
||||
const width = Math.max(220, this.parent.size[0])
|
||||
return [width, (width / ratio + 10)]
|
||||
},
|
||||
onRemoved: function () {
|
||||
if (this.inputEl) {
|
||||
this.inputEl.remove()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
w.inputEl = document.createElement(type === 'video' ? 'video' : 'img')
|
||||
w.inputEl.src = w.value
|
||||
if (type === 'video') {
|
||||
w.inputEl.setAttribute('type', 'video/webm');
|
||||
w.inputEl.autoplay = true
|
||||
w.inputEl.loop = true
|
||||
w.inputEl.controls = false;
|
||||
}
|
||||
w.inputEl.onload = function () {
|
||||
w.inputRatio = w.inputEl.naturalWidth / w.inputEl.naturalHeight
|
||||
}
|
||||
document.body.appendChild(w.inputEl)
|
||||
return w
|
||||
}
|
||||
|
||||
const gif_preview = {
|
||||
name: 'AnimateDiff.gif_preview',
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
switch (nodeData.name) {
|
||||
case 'ADE_AnimateDiffCombine':{
|
||||
const onExecuted = nodeType.prototype.onExecuted
|
||||
nodeType.prototype.onExecuted = function (message) {
|
||||
const prefix = 'ad_gif_preview_'
|
||||
const r = onExecuted ? onExecuted.apply(this, message) : undefined
|
||||
|
||||
if (this.widgets) {
|
||||
const pos = this.widgets.findIndex((w) => w.name === `${prefix}_0`)
|
||||
if (pos !== -1) {
|
||||
for (let i = pos; i < this.widgets.length; i++) {
|
||||
this.widgets[i].onRemoved?.()
|
||||
}
|
||||
this.widgets.length = pos
|
||||
}
|
||||
if (message?.gifs) {
|
||||
message.gifs.forEach((params, i) => {
|
||||
const previewUrl = api.apiURL(
|
||||
'/view?' + new URLSearchParams(params).toString()
|
||||
)
|
||||
const w = this.addCustomWidget(
|
||||
CreatePreviewElement(`${prefix}_${i}`, previewUrl, params.format || 'image/gif')
|
||||
)
|
||||
w.parent = this
|
||||
})
|
||||
}
|
||||
const onRemoved = this.onRemoved
|
||||
this.onRemoved = () => {
|
||||
cleanupNode(this)
|
||||
return onRemoved?.()
|
||||
}
|
||||
}
|
||||
this.setSize([this.size[0], this.computeSize([this.size[0], this.size[1]])[1]])
|
||||
return r
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.registerExtension(gif_preview)
|
||||
Reference in New Issue
Block a user