Skip to content

Commit

Permalink
version 1.76
Browse files Browse the repository at this point in the history
  • Loading branch information
Suzie1 committed Jan 24, 2024
1 parent efcdf63 commit d78b780
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 33 deletions.
5 changes: 5 additions & 0 deletions Patch_Notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# 🧩 Comfyroll Studio - Patch Notes

## v1.76 Jan 24, 2024
- added CR VAE Decode
- added CR Combine Prompt
- added CR Diamond Pattern

## v1.75.1 Jan 24, 2024
- fix for issue 112 CR Text Blacklist, added handling for blank lines and fixed issue with finding multiple keywords
- PR108, fix for missing import in nodes_utils_text.py
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Co-authored by Suzie1 and RockOfFire

Current version: 1.75
Current version: 1.76

# Wiki

Expand Down Expand Up @@ -31,9 +31,11 @@ __📦 Essential Nodes__
* CR Image Output (changed 18/12/2023)
* CR Latent Batch Size
* CR Prompt Text
* CR Combine Prompt
* CR Seed
* CR Conditioning Mixer
* CR Select Model
* CR Select Model (new 24/1/2024)
* CR VAE Decode (new 24/1/2024)

__🔳 Aspect Ratio__
* CR Aspect Ratio
Expand Down Expand Up @@ -167,7 +169,8 @@ __🌁 Graphics - Layout__
* CR Feathered Border (new 21/12/2023)
* CR Color Panel
* CR Simple Text Panel
* CR Half Drop Panel
* CR Half Drop Panel (new 23/1/2024)
* CR Diamond Panel (new 24/1/2024)
* CR Overlay Transparent Image
* CR Select ISO Size (new 18/1/2023)

Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .node_mappings import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS

print("------------------------------------------")
print("\033[34mComfyroll Studio v1.75 : \033[92m 175 Nodes Loaded\033[0m")
print("\033[34mComfyroll Studio v1.76 : \033[92m 175 Nodes Loaded\033[0m")
print("------------------------------------------")
print("** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md")
print("** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki")
Expand Down
14 changes: 9 additions & 5 deletions node_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
"CR Conditioning Mixer": CR_ConditioningMixer,
"CR Select Model": CR_SelectModel,
"CR Seed": CR_Seed,
"CR Prompt Text": CR_PromptText,
#"CR VAE Decode": CR_VAEDecode,
"CR Prompt Text": CR_PromptText,
"CR Combine Prompt": CR_CombinePrompt,
"CR VAE Decode": CR_VAEDecode,
### List Nodes
"CR Text List": CR_TextList,
"CR Prompt List": CR_PromptList,
Expand Down Expand Up @@ -164,7 +165,8 @@
"CR Simple Text Panel": CR_SimpleTextPanel,
"CR Color Panel": CR_ColorPanel,
"CR Overlay Transparent Image": CR_OverlayTransparentImage,
"CR Half Drop Panel": CR_HalfDropPanel,
"CR Half Drop Panel": CR_HalfDropPanel,
"CR Diamond Panel": CR_DiamondPanel,
#"CR Simple Titles": CR_SimpleTitles,
### Graphics Template
"CR Simple Meme Template": CR_SimpleMemeTemplate,
Expand Down Expand Up @@ -297,7 +299,8 @@
"CR Conditioning Mixer": "⚙️ CR Conditioning Mixer",
"CR Select Model": "🔮 CR Select Model",
"CR Prompt Text": "⚙️ CR Prompt Text",
#"CR VAE Decode": "⚙️ CR VAE Decode",
"CR Combine Prompt": "⚙️ CR Combine Prompt",
"CR VAE Decode": "⚙️ CR VAE Decode",
### List Nodes
"CR Text List": "📜 CR Text List",
"CR Prompt List": "📜 CR Prompt List",
Expand Down Expand Up @@ -403,7 +406,8 @@
"CR Image Grid Panel": "🌁 CR Image Grid Panel",
"CR Simple Text Panel": "🌁 CR Simple Text Panel",
"CR Color Panel": "🌁 CR Color Panel",
"CR Half Drop Panel": "🌁 CR Half Drop Panel",
"CR Half Drop Panel": "🌁 CR Half Drop Panel",
"CR Diamond Panel": "🌁 CR Diamond Panel",
"CR Page Layout": "🌁 CR Page Layout",
"CR Image Border": "🌁 CR Image Border",
"CR Feathered Border": "🌁 CR Feathered Border",
Expand Down
60 changes: 49 additions & 11 deletions nodes/nodes_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,51 @@ class CR_PromptText:

@classmethod
def INPUT_TYPES(s):
return {"required": {"prompt": ("STRING", {"default": "prompt", "multiline": True})}}
return {"required": {
"prompt": ("STRING", {"default": "prompt", "multiline": True})
}
}

RETURN_TYPES = ("STRING", "STRING", )
RETURN_NAMES = ("prompt", "show_help", )
FUNCTION = "get_value"
CATEGORY = icons.get("Comfyroll/Essential/Core")

def get_value(self, prompt):

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-prompt-text"

return (prompt, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
class CR_CombinePrompt:

@classmethod
def INPUT_TYPES(s):
return {"required": {
},
"optional": {
"part1": ("STRING", {"default": "", "multiline": True}),
"part2": ("STRING", {"default": "", "multiline": True}),
"part3": ("STRING", {"default": "", "multiline": True}),
"part4": ("STRING", {"default": "", "multiline": True}),
"separator": ("STRING", {"default": ",", "multiline": False}),
}
}

RETURN_TYPES = ("STRING", "STRING", )
RETURN_NAMES = ("prompt", "show_help", )
FUNCTION = "get_value"
CATEGORY = icons.get("Comfyroll/Essential/Core")

def get_value(self, part1="", part2="", part3="", part4="", separator=""):

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-prompt-parts"

prompt = part1 + separator + part2 + separator + part3 + separator + part4

return (prompt, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
class CR_ConditioningMixer:

Expand Down Expand Up @@ -350,27 +384,30 @@ class CR_VAEDecode:
@classmethod
def INPUT_TYPES(s):

padding_modes = ["zeros", "replicate", "circular"]

return {"required": {
"samples": ("LATENT", ),
"vae": ("VAE", ),
"padding_mode": (padding_modes,),
"tiled": ("BOOLEAN", {"default": False}),
"circular": ("BOOLEAN", {"default": False}),
}
}
RETURN_TYPES = ("IMAGE", "STRING", )
RETURN_NAMES = ("IMAGE", "show_help", )
FUNCTION = "vae_decode"
CATEGORY = icons.get("Comfyroll/Essential/Core")

def vae_decode(self, samples, vae, padding_mode):
def vae_decode(self, samples, vae, circular=False, tiled=False):

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-vae-decode"

for layer in [layer for layer in vae.first_stage_model.modules() if isinstance(layer, torch.nn.Conv2d)]:
layer.padding_mode = padding_mode

c = vae.decode(samples["samples"])

if circular == True:
for layer in [layer for layer in vae.first_stage_model.modules() if isinstance(layer, torch.nn.Conv2d)]:
layer.padding_mode = "circular"

if tiled == True:
c = vae.decode_tiled(samples["samples"], tile_x=512, tile_y=512, )
else:
c = vae.decode(samples["samples"])

return (c, show_help, )

Expand All @@ -385,9 +422,10 @@ def vae_decode(self, samples, vae, padding_mode):
"CR Latent Batch Size": CR_LatentBatchSize,
"CR Seed": CR_Seed,
"CR Prompt Text": CR_PromptText,
"CR Combine Prompt": CR_CombinePrompt,
"CR Conditioning Mixer": CR_ConditioningMixer,
"CR Select Model": CR_SelectModel,
#"CR VAE Decode": CR_VAEDecode,
"CR VAE Decode": CR_VAEDecode,
}
'''

67 changes: 54 additions & 13 deletions nodes/nodes_graphics_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ class CR_HalfDropPanel:
@classmethod
def INPUT_TYPES(s):

patterns = ["none", "half drop", "quarter drop", "diamond", "custom drop %"]
patterns = ["none", "half drop", "quarter drop", "custom drop %"]

return {"required": {
"image": ("IMAGE",),
Expand Down Expand Up @@ -660,8 +660,55 @@ def make_panel(self, image, pattern, drop_percentage=0.5):
panel_image.paste(pil_img, (0, y))
panel_image.paste(pil_img, (x, -3*y//4))
panel_image.paste(pil_img, (x, y//4))
panel_image.paste(pil_img, (x, 5*y//4))
elif pattern == "diamond":
panel_image.paste(pil_img, (x, 5*y//4))
elif pattern == "custom drop %":
panel_image.paste(pil_img, (0, 0))
panel_image.paste(pil_img, (0, y))
panel_image.paste(pil_img, (x, (d-100)*y//100))
panel_image.paste(pil_img, (x, d*y//100))
panel_image.paste(pil_img, (x, y + d*y//100))

image_out = pil2tensor(panel_image.convert('RGB'))

return (image_out, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
class CR_DiamondPanel:

@classmethod
def INPUT_TYPES(s):

patterns = ["none", "diamond"]

return {"required": {
"image": ("IMAGE",),
"pattern": (patterns,),
}
}

RETURN_TYPES = ("IMAGE", "STRING", )
RETURN_NAMES = ("image", "show_help", )
FUNCTION = "make_panel"
CATEGORY = icons.get("Comfyroll/Graphics/Layout")

def make_panel(self, image, pattern, drop_percentage=0.5):

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Layout-Nodes#cr-diamond-panel"

if pattern == "none":
return (image, show_help, )

# Convert to PIL image
pil_img = tensor2pil(image)
pil_img = pil_img.convert('RGBA')

x, y = pil_img.size
aspect_ratio = x / y
d = int(drop_percentage * 100)

panel_image = Image.new('RGBA', (x*2, y*2))

if pattern == "diamond":

diamond_size = min(x, y)
diamond_width = min(x, y * aspect_ratio)
Expand Down Expand Up @@ -693,19 +740,12 @@ def make_panel(self, image, pattern, drop_percentage=0.5):
panel_image.paste(diamond_image, (x, y), diamond_image)
panel_image.paste(diamond_image, (3*x//2, (d-100)*y//100), diamond_image)
panel_image.paste(diamond_image, (3*x//2, d*y//100), diamond_image)
panel_image.paste(diamond_image, (3*x//2, y + d*y//100), diamond_image)

elif pattern == "custom drop %":
panel_image.paste(pil_img, (0, 0))
panel_image.paste(pil_img, (0, y))
panel_image.paste(pil_img, (x, (d-100)*y//100))
panel_image.paste(pil_img, (x, d*y//100))
panel_image.paste(pil_img, (x, y + d*y//100))
panel_image.paste(diamond_image, (3*x//2, y + d*y//100), diamond_image)

image_out = pil2tensor(panel_image.convert('RGB'))

return (image_out, show_help, )

return (image_out, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_SelectISOSize:

Expand Down Expand Up @@ -745,6 +785,7 @@ def get_size(self, iso_size):
"CR Page Layout": CR_PageLayout,
"CR Image Grid Panel": CR_ImageGridPanel,
"CR Half Drop Panel": CR_HalfDropPanel,
"CR Diamond Panel": CR_DiamondPanel,
"CR Image Border": CR_ImageBorder,
"CR Feathered Border": CR_FeatheredBorder,
"CR Color Panel": CR_ColorPanel,
Expand Down

0 comments on commit d78b780

Please sign in to comment.