Skip to content

Commit

Permalink
Nodes will only work in the new frontend
Browse files Browse the repository at this point in the history
updated to frontend 1.2.28
  • Loading branch information
Amorano committed Aug 23, 2024
1 parent d331aa9 commit a854f18
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 296 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ glsl/*
config.json
ignore.txt
.env
.venv
.DS_Store
*.egg-info
*.bak
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
<img alt="ComfyUI Nodes for procedural masking, live composition and video manipulation">
</picture>

<h3><div align="center">
<h2><div align="center">
<a href="https://github.com/comfyanonymous/ComfyUI">COMFYUI</a> Nodes for procedural masking, live composition and video manipulation
</div></h2>

<h3><div align="center">
JOVIMETRIX IS ONLY GAURENTEED TO SUPPORT <a href="https://github.com/comfyanonymous/ComfyUI">COMFYUI 0.0.7+</a> and <a href="https://github.com/Comfy-Org/ComfyUI_frontend">FRONTEND 1.2.27+</a><br>
IF YOU NEED AN OLDER VERSION, PLEASE DO NOT UPDATE.
</div></h3>

<!---------------------------------------------------------------------------->
Expand Down
49 changes: 1 addition & 48 deletions node_list.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,15 @@
{
"ADJUST (JOV) \ud83d\udd78\ufe0f": "Enhance and modify images with various effects such as blurring, sharpening, color tweaks, and edge detection",
"AKASHIC (JOV) \ud83d\udcd3": "Visualize data",
"ARRAY (JOV) \ud83d\udcda": "Processes a batch of data based on the selected mode, such as merging, picking, slicing, random selection, or indexing",
"BLEND (JOV) \u2697\ufe0f": "Combine two input images using various blending modes, such as normal, screen, multiply, overlay, etc",
"COLOR BLIND (JOV) \ud83d\udc41\u200d\ud83d\udde8": "Simulate color blindness effects on images",
"COLOR MATCH (JOV) \ud83d\udc9e": "Adjust the color scheme of one image to match another with the Color Match Node",
"COLOR THEORY (JOV) \ud83d\udede": "Generate a color harmony based on the selected scheme",
"COMPARISON (JOV) \ud83d\udd75\ud83c\udffd": "Evaluates two inputs (A and B) with a specified comparison operators and optional values for successful and failed comparisons",
"CONSTANT (JOV) \ud83d\udfea": "Generate a constant image or mask of a specified size and color",
"CROP (JOV) \u2702\ufe0f": "Extract a portion of an input image or resize it",
"DELAY (JOV) \u270b\ud83c\udffd": "Introduce pauses in the workflow that accept an optional input to pass through and a timer parameter to specify the duration of the delay",
"EXPORT (JOV) \ud83d\udcfd": "Responsible for saving images or animations to disk",
"FILTER MASK (JOV) \ud83e\udd3f": "Create masks based on specific color ranges within an image",
"FLATTEN (JOV) \u2b07\ufe0f": "Combine multiple input images into a single image by summing their pixel values",
"GLSL (JOV) \ud83c\udf69": "Execute custom GLSL (OpenGL Shading Language) fragment shaders to generate images or apply effects",
"GLSL BLEND LINEAR (JOV) \ud83e\uddd9\ud83c\udffd": "Simple linear blend between two images",
"GLSL GRAYSCALE (JOV) \ud83e\uddd9\ud83c\udffd": "Convert input to grayscale",
"GLSL HSV-2-LAB (JOV) \ud83e\uddd9\ud83c\udffd": "Convert HSV image into LAB color space",
"GLSL HSV-2-RGB (JOV) \ud83e\uddd9\ud83c\udffd": "Convert HSV image into RGB color space",
"GLSL LAB-2-HSV (JOV) \ud83e\uddd9\ud83c\udffd": "Convert LAB image into HSV color space",
"GLSL LAB-2-RGB (JOV) \ud83e\uddd9\ud83c\udffd": "Convert LAB image into RGB color space",
"GLSL LAB-2-XYZ (JOV) \ud83e\uddd9\ud83c\udffd": "Convert LAB image into XYZ color space",
"GLSL NORMAL (JOV) \ud83e\uddd9\ud83c\udffd": "Convert input into a Normal map",
"GLSL NORMAL BLEND (JOV) \ud83e\uddd9\ud83c\udffd": "Blend two Normal maps",
"GLSL RGB-2-HSV (JOV) \ud83e\uddd9\ud83c\udffd": "Convert RGB(A) input into HSV color space",
"GLSL RGB-2-LAB (JOV) \ud83e\uddd9\ud83c\udffd": "Convert RGB(A) image into LAB color space",
"GLSL RGB-2-XYZ (JOV) \ud83e\uddd9\ud83c\udffd": "Convert RGB(A) input into XYZ color space",
"GLSL XYZ-2-LAB (JOV) \ud83e\uddd9\ud83c\udffd": "Convert XYZ(W) image into LAB color space",
"GLSL XYZ-2-RGB (JOV) \ud83e\uddd9\ud83c\udffd": "Convert XYZ(W) image into RGB color space",
"GRADIENT MAP (JOV) \ud83c\uddf2\ud83c\uddfa": "Remaps an input image using a gradient lookup table (LUT)",
"GRAPH (JOV) \ud83d\udcc8": "Visualize a series of data points over time",
"IMAGE INFO (JOV) \ud83d\udcda": "Exports and Displays immediate information about images",
"LERP (JOV) \ud83d\udd30": "Calculate linear interpolation between two values or vectors based on a blending factor (alpha)",
"MIDI FILTER (JOV) \u2733\ufe0f": "Provides advanced filtering capabilities for MIDI messages based on various criteria, including MIDI mode (such as note on or note off), MIDI channel, control number, note number, value, and normalized value",
"MIDI FILTER EZ (JOV) \u2747\ufe0f": "Filter MIDI messages based on various criteria, including MIDI mode (such as note on or note off), MIDI channel, control number, note number, value, and normalized value",
"MIDI MESSAGE (JOV) \ud83c\udf9b\ufe0f": "Processes MIDI messages received from an external MIDI controller or device",
"MIDI READER (JOV) \ud83c\udfb9": "Captures MIDI messages from an external MIDI device or controller",
"OP BINARY (JOV) \ud83c\udf1f": "Execute binary operations like addition, subtraction, multiplication, division, and bitwise operations on input values, supporting various data types and vector sizes",
"OP UNARY (JOV) \ud83c\udfb2": "Perform single function operations like absolute value, mean, median, mode, magnitude, normalization, maximum, or minimum on input values",
"PIXEL MERGE (JOV) \ud83e\udec2": "Combines individual color channels (red, green, blue) along with an optional mask channel to create a composite image",
"PIXEL SPLIT (JOV) \ud83d\udc94": "Takes an input image and splits it into its individual color channels (red, green, blue), along with a mask channel",
"PIXEL SWAP (JOV) \ud83d\udd03": "Swap pixel values between two input images based on specified channel swizzle operations",
"QUEUE (JOV) \ud83d\uddc3": "Manage a queue of items, such as file paths or data",
"ROUTE (JOV) \ud83d\ude8c": "Routes the input data from the optional input ports to the output port, preserving the order of inputs",
"SAVE OUTPUT (JOV) \ud83d\udcbe": "Save the output image along with its metadata to the specified path",
"SHAPE GEN (JOV) \u2728": "Create n-sided polygons",
"SPOUT WRITER (JOV) \ud83c\udfa5": "Sends frames to a specified Spout receiver application for real-time video sharing",
"STACK (JOV) \u2795": "Merge multiple input images into a single composite image by stacking them along a specified axis",
"STEREOGRAM (JOV) \ud83d\udcfb": "Generates false perception 3D images from 2D input",
"STEREOSCOPIC (JOV) \ud83d\udd76\ufe0f": "Simulates depth perception in images by generating stereoscopic views",
"STREAM READER (JOV) \ud83d\udcfa": "Capture frames from various sources such as URLs, cameras, monitors, windows, or Spout streams",
"STREAM WRITER (JOV) \ud83c\udf9e\ufe0f": "Sends frames to a specified route, typically for live streaming or recording purposes",
"SWIZZLE (JOV) \ud83d\ude35": "Swap components between two vectors based on specified swizzle patterns and values",
"TEXT GEN (JOV) \ud83d\udcdd": "Generates images containing text based on parameters such as font, size, alignment, color, and position",
"THRESHOLD (JOV) \ud83d\udcc9": "Define a range and apply it to an image for segmentation and feature extraction",
"TICK (JOV) \u23f1": "A timer and frame counter, emitting pulses or signals based on time intervals",
"TRANSFORM (JOV) \ud83c\udfdd\ufe0f": "Apply various geometric transformations to images, including translation, rotation, scaling, mirroring, tiling and perspective projection",
"VALUE (JOV) \ud83e\uddec": "Supplies raw or default values for various data types, supporting vector input with components for X, Y, Z, and W",
"WAVE GEN (JOV) \ud83c\udf0a": "Produce waveforms like sine, square, or sawtooth with adjustable frequency, amplitude, phase, and offset",
"WAVE GRAPH (JOV) \u25b6 \u0131l\u0131\u0131l\u0131": "The Wave Graph node visualizes audio waveforms as bars"
"WAVE GEN (JOV) \ud83c\udf0a": "Produce waveforms like sine, square, or sawtooth with adjustable frequency, amplitude, phase, and offset"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "jovimetrix"
description = "Integrates Webcam, MIDI, Spout and GLSL shader support. Animation via tick. Parameter manipulation with wave generator. Math operations with Unary and Binary support. Value conversion for all major types (int, string, list, dict, Image, Mask). Shape mask generation, image stacking and channel ops, batch splitting, merging and randomizing, load images and video from anywhere, dynamic bus routing with a single node, export support for GIPHY, save output anywhere! flatten, crop, transform; check colorblindness, make stereogram or stereoscopic images, or liner interpolate values and more."
version = "1.2.27"
version = "1.2.28"
license = { file = "LICENSE" }
dependencies = [
"aenum>=3.1.15,<4",
Expand Down
Binary file added reqire.txt
Binary file not shown.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
aenum>=3.1.15,<4
blendmodes>=2024.1.1
cupy-cuda12x>=13.3.0
daltonlens>=0.1.5
glfw>=2.7.0
loguru>=0.7.2
Expand Down
109 changes: 97 additions & 12 deletions web/core/core_color.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import { app } from '../../../scripts/app.js'
import { $el } from '../../../scripts/ui.js'
import { apiPost } from '../util/util_api.js'
import { colorContrast } from '../util/util.js'
import * as util_config from '../util/util_config.js'
import '../extern/jsColorPicker.js'
import { colorPicker } from '../extern/jsColorPicker.js'

// gets the CONFIG entry for name
function nodeColorGet(node) {
Expand Down Expand Up @@ -75,14 +76,6 @@ function nodeColorAll() {
app.canvas.setDirty(true);
}

/*
const colorClear = (name) => {
apiPost("/jovimetrix/config/clear", { name });
delete util_config.CONFIG_THEME[name];
if (util_config.CONFIG_COLOR.overwrite) nodeColorAll();
};
*/

class JovimetrixPanelColorize {
constructor() {

Expand Down Expand Up @@ -199,10 +192,10 @@ class JovimetrixPanelColorize {
}
});
} else if (retries > 0) {
console.warn(`jsColorPicker not available, retrying... (${retries} attempts left)`);
console.warn(`colorPicker not available, retrying... (${retries} attempts left)`);
setTimeout(() => this.initializeColorPicker(retries - 1), 1000);
} else {
console.error('jsColorPicker function is not available after multiple attempts');
console.error('colorPicker function is not available after multiple attempts');
}
}

Expand Down Expand Up @@ -432,4 +425,96 @@ app.extensionManager.registerSidebarTab({
el.appendChild(content);
}
}
});
});

app.registerExtension({
name: "jovimetrix.color",
async setup(app) {
// Option for user to contrast text for better readability
const original_color = LiteGraph.NODE_TEXT_COLOR;

util_config.setting_make('color 🎨.contrast', 'Auto-Contrast Text', 'boolean', 'Auto-contrast the title text for all nodes for better readability', true);

const drawNodeShape = LGraphCanvas.prototype.drawNodeShape;
LGraphCanvas.prototype.drawNodeShape = function() {
const contrast = localStorage["Comfy.Settings.jov.user.default.color.contrast"] || false;
if (contrast == true) {
var color = this.color || LiteGraph.NODE_TITLE_COLOR;
var bgcolor = this.bgcolor || LiteGraph.WIDGET_BGCOLOR;
this.node_title_color = colorContrast(color) ? "#000" : "#FFF";
LiteGraph.NODE_TEXT_COLOR = colorContrast(bgcolor) ? "#000" : "#FFF";
} else {
this.node_title_color = original_color
LiteGraph.NODE_TEXT_COLOR = original_color;
}
drawNodeShape.apply(this, arguments);
};

if (util_config.CONFIG_USER.color.overwrite) {
nodeColorAll();
}
},
async beforeRegisterNodeDef(nodeType) {
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = async function () {
const me = onNodeCreated?.apply(this, arguments);
if (this) {
nodeColorReset(this, false);
}
return me;
}
}
})

function initializeColorPicker() {
const elements = document.querySelectorAll('input.jov-color');
if (elements.length) {
colorPicker(elements, {
readOnly: true,
size: 2,
multipleInstances: false,
appendTo: document,
noAlpha: false,
init: function(elm, rgb) {
elm.style.backgroundColor = elm.color || LiteGraph.WIDGET_BGCOLOR;
elm.style.color = rgb.RGBLuminance > 0.22 ? '#222' : '#ddd'
},
convertCallback: function(data) {
let AHEX = this.patch.attributes.color;
if (!AHEX) return;

let name = this.patch.attributes.name.value;
const parts = name.split('.');
const part = parts.pop();
name = parts[0];
let api_packet = {};

if (parts.length > 1) {
const idx = parts[1];
let data = util_config.CONFIG_REGEX[idx];
data[part] = AHEX.value;
util_config.CONFIG_REGEX[idx] = data;

api_packet = {
id: `${util_config.USER}.color.regex`,
v: util_config.CONFIG_REGEX
};
} else {
const themeConfig = util_config.CONFIG_THEME[name] || (util_config.CONFIG_THEME[name] = {});
themeConfig[part] = AHEX.value;

api_packet = {
id: `${util_config.USER}.color.theme.${name}`,
v: themeConfig
};
}
apiPost("/jovimetrix/config", api_packet);
if (util_config.CONFIG_COLOR.overwrite) {
nodeColorAll();
}
}
});
}
}

window.addEventListener('DOMContentLoaded', initializeColorPicker);
2 changes: 1 addition & 1 deletion web/core/core_cozy_tips.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ app.registerExtension({
if (!tip) {
return hideTooltip();
}
showTooltip(tip, app.canvas.mouse[0], app.canvas.mouse[1] - 18);
showTooltip(tip, app.canvas.mouse[0], app.canvas.mouse[1] - 26);
}.bind(app.canvas);

app.ui.settings.addSetting({
Expand Down
Loading

0 comments on commit a854f18

Please sign in to comment.