File size: 1,091 Bytes
f2dbf59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import comfy
import nodes
from . import utils

SCHEDULERS = comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', "GITS[coeff=1.2]"]


def impact_sampling(*args, **kwargs):
    if 'RegionalSampler' not in nodes.NODE_CLASS_MAPPINGS:
        utils.try_install_custom_node('https://github.com/ltdrdata/ComfyUI-Impact-Pack',
                                      "'Impact Pack' extension is required.")
        raise Exception(f"[ERROR] You need to install 'ComfyUI-Impact-Pack'")

    return nodes.NODE_CLASS_MAPPINGS['RegionalSampler'].separated_sample(*args, **kwargs)


changed_count_cache = {}
changed_cache = {}


def changed_value(uid):
    v = changed_count_cache.get(uid, 0)
    changed_count_cache[uid] = v + 1
    return v + 1


def not_changed_value(uid):
    return changed_count_cache.get(uid, 0)


def is_changed(uid, value):
    if uid not in changed_cache or changed_cache[uid] != value:
        res = changed_value(uid)
    else:
        res = not_changed_value(uid)

    changed_cache[uid] = value

    print(f"keys: {changed_cache.keys()}")

    return res