diff --git a/__init__.py b/__init__.py index ec78379..2a3a0a9 100644 --- a/__init__.py +++ b/__init__.py @@ -1,6 +1,8 @@ from .nodes.context.base_context import TT_BaseContext from .nodes.context.context import TT_Context from .nodes.context.context_passthrough import TT_ContextPassthrough +from .nodes.context.context_set_image import TT_ContextSetImage +from .nodes.context.context_set_latent import TT_ContextSetLatent from .nodes.context.even_larger_context import TT_EvenLargerContext from .nodes.context.large_context_flux import TT_LargeContextFlux from .nodes.context.large_context_sdxl import TT_LargeContextSdxl @@ -40,6 +42,8 @@ NODE_CLASS_MAPPINGS = { "TT_LargeContextFlux": TT_LargeContextFlux, "TT_LargeContextSdxl": TT_LargeContextSdxl, "TT_EvenLargerContext": TT_EvenLargerContext, + "TT_ContextSetImage": TT_ContextSetImage, + "TT_ContextSetLatent": TT_ContextSetLatent, # Context Passthrough "TT_ContextPassthrough": TT_ContextPassthrough, # Image @@ -87,8 +91,11 @@ NODE_DISPLAY_NAME_MAPPINGS = { "TT_LargeContextFlux": "TT FLUX Large Context", "TT_LargeContextSdxl": "TT SDXL Large Context", "TT_EvenLargerContext": "TT Even Larger Context", + "TT_ContextSetImage": "TT Context Set Image", + "TT_ContextSetLatent": "TT Context Set Latent", # Context Passthrough "TT_ContextPassthrough": "TT Context Passthrough", + # Image "TT_ImagePreviewSave": "TT Image Preview / Save", # Latent "TT_LatentFactory": "TT Latent Factory", diff --git a/nodes/context/context_helpers.py b/nodes/context/context_helpers.py index 88c6311..f86d2d1 100644 --- a/nodes/context/context_helpers.py +++ b/nodes/context/context_helpers.py @@ -128,6 +128,24 @@ CONTEXTS = { "context", ) }, + "set_image":{ + "required": ( + "context", + "image", + ), + "return": ( + "context", + ) + }, + "set_latent":{ + "required": ( + "context", + "latent", + ), + "return": ( + "context", + ) + }, } FORCE_INPUT_TYPES = { diff --git a/nodes/context/context_set_image.py b/nodes/context/context_set_image.py new file mode 100644 index 0000000..0b85f92 --- /dev/null +++ b/nodes/context/context_set_image.py @@ -0,0 +1,16 @@ +from .context_helpers import create_context_schema + + +class TT_ContextSetImage: + INPUT_TYPES_DICT, RETURN_TYPES, RETURN_NAMES = create_context_schema("set_image") + FUNCTION = "process_context" + CATEGORY = "TenserTensor/Context" + + @classmethod + def INPUT_TYPES(cls): + return cls.INPUT_TYPES_DICT + + def process_context(self, context, image): + context["image"] = image + + return (context,) diff --git a/nodes/context/context_set_latent.py b/nodes/context/context_set_latent.py new file mode 100644 index 0000000..64c5de4 --- /dev/null +++ b/nodes/context/context_set_latent.py @@ -0,0 +1,16 @@ +from .context_helpers import create_context_schema + + +class TT_ContextSetLatent: + INPUT_TYPES_DICT, RETURN_TYPES, RETURN_NAMES = create_context_schema("set_latent") + FUNCTION = "process_context" + CATEGORY = "TenserTensor/Context" + + @classmethod + def INPUT_TYPES(cls): + return cls.INPUT_TYPES_DICT + + def process_context(self, context, latent): + context["latent"] = latent + + return (context,) diff --git a/web/docs/TT_ContextSetImage.md b/web/docs/TT_ContextSetImage.md new file mode 100644 index 0000000..fb6d387 --- /dev/null +++ b/web/docs/TT_ContextSetImage.md @@ -0,0 +1,26 @@ +## TT Context Set Image *TT_ContextSetImage* + +*This description was generated with AI assistance. If you spot any errors, please create an issue on GitHub.* + +Adds or updates image in context object. + +### Inputs + +| Parameter | Type | Required | Description | +|-----------|------------|----------|--------------------------------| +| `context` | TT_CONTEXT | Yes | Context to update | +| `image` | IMAGE | Yes | Image to store in context | + +### Outputs + +| Parameter | Type | Description | +|-----------|------------|-------------------------| +| `CONTEXT` | TT_CONTEXT | Updated context object | + +### Usage + +Stores pixel-space image in context for use by downstream nodes. Overwrites existing image if present. + +--- + +[View on GitHub](https://github.com/tenser-tensor/ComfyUI-TenserTensor) diff --git a/web/docs/TT_ContextSetLatent.md b/web/docs/TT_ContextSetLatent.md new file mode 100644 index 0000000..aa10bf7 --- /dev/null +++ b/web/docs/TT_ContextSetLatent.md @@ -0,0 +1,26 @@ +## TT Context Set Image *TT_ContextSetImage* + +*This description was generated with AI assistance. If you spot any errors, please create an issue on GitHub.* + +Adds or updates latent image in context object. + +### Inputs + +| Parameter | Type | Required | Description | +|-----------|------------|----------|----------------------------------| +| `context` | TT_CONTEXT | Yes | Context to update | +| `latent` | LATENT | Yes | Latent image to store in context | + +### Outputs + +| Parameter | Type | Description | +|-----------|------------|------------------------| +| `CONTEXT` | TT_CONTEXT | Updated context object | + +### Usage + +Stores latent representation in context for use by downstream nodes. Overwrites existing latent if present. + +--- + +[View on GitHub](https://github.com/tenser-tensor/ComfyUI-TenserTensor)