Skip to content

Commit

Permalink
(minor) Tweak field ordering and field names for tiling nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanJDick committed Nov 30, 2023
1 parent bb87c98 commit 07e7c9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions invokeai/app/invocations/latent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,12 +1190,12 @@ class CropLatentsCoreInvocation(BaseInvocation):
description=FieldDescriptions.latents,
input=Input.Connection,
)
x_offset: int = InputField(
x: int = InputField(
ge=0,
multiple_of=LATENT_SCALE_FACTOR,
description="The left x coordinate (in px) of the crop rectangle in image space. This value will be converted to a dimension in latent space.",
)
y_offset: int = InputField(
y: int = InputField(
ge=0,
multiple_of=LATENT_SCALE_FACTOR,
description="The top y coordinate (in px) of the crop rectangle in image space. This value will be converted to a dimension in latent space.",
Expand All @@ -1214,8 +1214,8 @@ class CropLatentsCoreInvocation(BaseInvocation):
def invoke(self, context: InvocationContext) -> LatentsOutput:
latents = context.services.latents.get(self.latents.latents_name)

x1 = self.x_offset // LATENT_SCALE_FACTOR
y1 = self.y_offset // LATENT_SCALE_FACTOR
x1 = self.x // LATENT_SCALE_FACTOR
y1 = self.y // LATENT_SCALE_FACTOR
x2 = x1 + (self.width // LATENT_SCALE_FACTOR)
y2 = y1 + (self.height // LATENT_SCALE_FACTOR)

Expand Down
8 changes: 4 additions & 4 deletions invokeai/app/invocations/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def invoke(self, context: InvocationContext) -> CalculateImageTilesOutput:

@invocation_output("tile_to_properties_output")
class TileToPropertiesOutput(BaseInvocationOutput):
coords_top: int = OutputField(description="Top coordinate of the tile relative to its parent image.")
coords_bottom: int = OutputField(description="Bottom coordinate of the tile relative to its parent image.")
coords_left: int = OutputField(description="Left coordinate of the tile relative to its parent image.")
coords_right: int = OutputField(description="Right coordinate of the tile relative to its parent image.")
coords_top: int = OutputField(description="Top coordinate of the tile relative to its parent image.")
coords_bottom: int = OutputField(description="Bottom coordinate of the tile relative to its parent image.")

# HACK: The width and height fields are 'meta' fields that can easily be calculated from the other fields on this
# object. Including redundant fields that can cheaply/easily be re-calculated goes against conventional API design
Expand All @@ -85,10 +85,10 @@ class TileToPropertiesInvocation(BaseInvocation):

def invoke(self, context: InvocationContext) -> TileToPropertiesOutput:
return TileToPropertiesOutput(
coords_top=self.tile.coords.top,
coords_bottom=self.tile.coords.bottom,
coords_left=self.tile.coords.left,
coords_right=self.tile.coords.right,
coords_top=self.tile.coords.top,
coords_bottom=self.tile.coords.bottom,
width=self.tile.coords.right - self.tile.coords.left,
height=self.tile.coords.bottom - self.tile.coords.top,
overlap_top=self.tile.overlap.top,
Expand Down

0 comments on commit 07e7c9e

Please sign in to comment.