This commit is contained in:
kijai 2024-06-26 00:16:39 +03:00
commit 2ead4fae1d
8 changed files with 14 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
__pycache__ __pycache__
/venv /venv
*.code-workspace
.history
.vscode .vscode
*.ckpt *.ckpt
*.pth *.pth

View File

@ -872,10 +872,14 @@ nodes for example.
mask_adjusted = mask * mask_opacity mask_adjusted = mask * mask_opacity
mask_image = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3).clone() mask_image = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3).clone()
color_list = list(map(int, mask_color.split(', '))) if ',' in mask_color:
mask_image[:, :, :, 0] = color_list[0] // 255 # Red channel color_list = np.clip([int(channel) for channel in mask_color.split(',')], 0, 255) # RGB format
mask_image[:, :, :, 1] = color_list[1] // 255 # Green channel else:
mask_image[:, :, :, 2] = color_list[2] // 255 # Blue channel mask_color = mask_color.lstrip('#')
color_list = [int(mask_color[i:i+2], 16) for i in (0, 2, 4)] # Hex format
mask_image[:, :, :, 0] = color_list[0] / 255 # Red channel
mask_image[:, :, :, 1] = color_list[1] / 255 # Green channel
mask_image[:, :, :, 2] = color_list[2] / 255 # Blue channel
preview, = ImageCompositeMasked.composite(self, image, mask_image, 0, 0, True, mask_adjusted) preview, = ImageCompositeMasked.composite(self, image, mask_image, 0, 0, True, mask_adjusted)
if pass_through: if pass_through:

View File

@ -7,7 +7,7 @@ import comfy.sample
from nodes import CLIPTextEncode from nodes import CLIPTextEncode
script_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) script_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
folder_paths.add_model_folder_path("intristic_loras", os.path.join(script_directory, "intristic_loras")) folder_paths.add_model_folder_path("intrinsic_loras", os.path.join(script_directory, "intrinsic_loras"))
class Intrinsic_lora_sampling: class Intrinsic_lora_sampling:
def __init__(self): def __init__(self):
@ -16,7 +16,7 @@ class Intrinsic_lora_sampling:
@classmethod @classmethod
def INPUT_TYPES(s): def INPUT_TYPES(s):
return {"required": { "model": ("MODEL",), return {"required": { "model": ("MODEL",),
"lora_name": (folder_paths.get_filename_list("intristic_loras"), ), "lora_name": (folder_paths.get_filename_list("intrinsic_loras"), ),
"task": ( "task": (
[ [
'depth map', 'depth map',
@ -81,7 +81,7 @@ with this node pack.
#load lora #load lora
model_clone = model.clone() model_clone = model.clone()
lora_path = folder_paths.get_full_path("intristic_loras", lora_name) lora_path = folder_paths.get_full_path("intrinsic_loras", lora_name)
lora = load_torch_file(lora_path, safe_load=True) lora = load_torch_file(lora_path, safe_load=True)
self.loaded_lora = (lora_path, lora) self.loaded_lora = (lora_path, lora)