fixes, toml, readme, gitattributes

updates requirements, now scale does so from center, various other updates
This commit is contained in:
RyanOnTheInside
2024-08-15 11:43:09 -04:00
parent d91acc7973
commit 5d8bc5294f
9 changed files with 2771 additions and 2456 deletions
+1
View File
@@ -0,0 +1 @@
assets/* export-ignore
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+2707 -2435
View File
File diff suppressed because it is too large Load Diff
+10 -2
View File
@@ -139,9 +139,10 @@ class MaskBase(ABC):
class TemporalMaskBase(MaskBase, ABC):
@classmethod
def INPUT_TYPES(cls):
parent_inputs = super().INPUT_TYPES()
return {
"required": {
**super().INPUT_TYPES()["required"],
**parent_inputs["required"],
"start_frame": ("INT", {"default": 0, "min": 0, "max": 1000, "step": 1}),
"end_frame": ("INT", {"default": 0, "min": 0, "max": 1000, "step": 1}),
"effect_duration": ("INT", {"default": 0, "min": 0, "max": 1000, "step": 1}),
@@ -150,6 +151,9 @@ class TemporalMaskBase(MaskBase, ABC):
}
}
def __init__(self):
super().__init__()
@abstractmethod
def process_single_mask(self, mask: np.ndarray, strength: float, **kwargs) -> np.ndarray:
"""
@@ -208,9 +212,10 @@ class TemporalMaskBase(MaskBase, ABC):
class ParticleSystemMaskBase(MaskBase, ABC):
@classmethod
def INPUT_TYPES(cls):
parent_inputs = super().INPUT_TYPES()
return {
"required": {
**super().INPUT_TYPES()["required"],
**parent_inputs["required"],
"emitters": ("PARTICLE_EMITTER",),
"particle_count": ("INT", {"default": 200, "min": 1, "max": 10000, "step": 1}),
"particle_lifetime": ("FLOAT", {"default": 4.0, "min": 0.1, "max": 10.0, "step": 0.1}),
@@ -593,6 +598,9 @@ class OpticalFlowMaskBase(MaskBase, ABC):
CATEGORY = "/RyanOnTheInside/masks/"
def __init__(self):
super().__init__()
def process_mask(self, mask: np.ndarray, strength: float, images: np.ndarray, flow_method: str, flow_threshold: float, magnitude_threshold: float, frame_index: int, **kwargs) -> np.ndarray:
if frame_index == 0 or frame_index >= len(images) - 1:
return mask
+8 -4
View File
@@ -61,12 +61,16 @@ def rotate_mask(mask: np.ndarray, angle: float) -> np.ndarray:
def scale_mask(mask: np.ndarray, scale_x: float, scale_y: float) -> np.ndarray:
height, width = mask.shape[:2]
M = cv2.getAffineTransform(
np.float32([[0, 0], [width, 0], [0, height]]),
np.float32([[0, 0], [width * scale_x, 0], [0, height * scale_y]])
)
center_x, center_y = width / 2, height / 2
M = np.float32([
[scale_x, 0, center_x * (1 - scale_x)],
[0, scale_y, center_y * (1 - scale_y)]
])
return warp_affine(mask, M)
def transform_mask(mask: np.ndarray, transform_type: str, x_value: float, y_value: float) -> np.ndarray:
if transform_type == "translate":
return translate_mask(mask, x_value, y_value)
+2 -2
View File
@@ -160,8 +160,8 @@ class TextMaskNode:
"font_size": ("INT", {"default": 32, "min": 1, "max": 1000}),
"font_color": ("STRING", {"default": "(255,255,255)"}),
"background_color": ("STRING", {"default": "(0,0,0)"}),
"x_position": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0}),
"y_position": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0}),
"x_position": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step":0.01}),
"y_position": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step":0.01}),
"rotation": ("FLOAT", {"default": 0, "min": 0, "max": 360}),
"max_width_ratio": ("FLOAT", {"default": 0.9, "min": 0.1, "max": 1.0}),
"batch_size": ("INT", {"default": 1, "min": 1, "max": 10000}),
+25
View File
@@ -0,0 +1,25 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ComfyUI_RyanOnTheInside"
description = "Custom nodes introducing particle simulations, optical flow, and temporal masks"
version = "0.1.0"
license = { text = "CC BY-NC 4.0" }
dependencies = [
"opencv-python==4.10",
"scipy",
"pillow",
"librosa",
"pymunk==6.8.1",
"matplotlib"
]
[project.urls]
Repository = "https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside"
[tool.comfy]
PublisherId = "ryanontheinside"
DisplayName = "RyanOnTheInside"
Icon = ""
+15 -6
View File
@@ -6,13 +6,18 @@ RyanOnTheInside node pack introduces the following (so far):
- Optical Flow
- Temporal Masks
<img src="./assets/RyanOnTheInside.gif" width="400" alt="RyanOnTheInside particle demo header">
<div style="display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start;">
<img src="./assets/particle_systems.gif" style="max-width: 400px; width: calc(50% - 5px); height: auto;" alt="RyanOnTheInside particle demo header">
<img src="./assets/optical_flow.gif" style="max-width: 400px; width: calc(50% - 5px); height: auto;" alt="RyanOnTheInside optical flow demo">
<div style="display: flex; flex-direction: column; max-width: 400px; width: calc(50% - 5px);">
<img src="./assets/time.gif" style="width: 100%; height: auto;" alt="Time">
<img src="./assets/plume_examples.gif" style="width: 100%; height: auto; margin-top: 10px;" alt="Plume examples using two particle emitters">
</div>
<img src="./assets/iris.gif" style="max-width: 400px; width: calc(50% - 5px); height: auto;" alt="Plume examples using two particle emitters">
</div>
<img src="./assets/plume_examples.gif" width="400" alt="Plume examples using two particle emitters">
<img src="./assets/iris.gif" width="400" alt="Plume examples using two particle emitters">
*Some examples using particle emitters and vortices*
*Some examples using particle emitters and vortices*
## Installation
@@ -160,6 +165,10 @@ Motion-based effects:
- Directional flow isolation and emphasis - in progress
- Advanced blending and modulation options
<img src="./assets/opticalflow_examples.gif" width="400" alt="Particle System Demo">
*Motion generated trails*
### Optical Flow Mask Nodes
#### General optical mask settings
+3 -7
View File
@@ -1,10 +1,6 @@
opencv-python
numpy
torch
tqdm
opencv-python==4.10
scipy
pillow
librosa
pymunk
matplotlib
Pillow
pymunk==6.8.1
matplotlib