ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Add Convert Data Type Node

Open LaVie024 opened this issue 7 months ago • 2 comments

Per my previous PR, I initially created five nodes, though it became obvious that it couldn't work out. I then learned of the existence of Impact Pack's Convert Data Type node, which is what this node is largely based upon. I decided to add more options to the float as per my previous PR had, as well as the ability to also output a combo. Returns null on int and float output if the string cannot be converted to a float.

2025-05-19_14-45

The main functions this introduces:

  1. The user is able to choose what rounding type to use on a float or a string representing a float before it is converted to an integer. We are able to choose to just truncate, round, or do banker's rounding on a float.
  2. The user is able to choose if a float is to be rounded before being converted to a string, and to choose how many decimal points, or to just display the full float.

Mainly, this is meant to be an extremely simple method to convert data types without needing a node for each type to be converted.

LaVie024 avatar May 19 '25 18:05 LaVie024

  • Related: https://github.com/comfyanonymous/ComfyUI/pull/8024#issuecomment-2892551496

webfiltered avatar May 20 '25 02:05 webfiltered