updated to v2.0.0
added new features such as dynamic sum adjustment and sum-lock dynamics
This commit is contained in:
+18
-9
@@ -1,5 +1,5 @@
|
||||
import folder_paths
|
||||
import re
|
||||
import re
|
||||
|
||||
# Updated Node name for registration
|
||||
RECEIVER_NODE_NAME = "Slider Receiver (DSS)" # Internal name
|
||||
@@ -9,11 +9,10 @@ RECEIVER_NODE_NAME = "Slider Receiver (DSS)" # Internal name
|
||||
class TSC_Slider_Receiver_Standalone: # Keep class name for now, just update registration
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
# ... (INPUT_TYPES remain the same) ...
|
||||
return {
|
||||
"required": {
|
||||
"weights_string": ("STRING", {"multiline": False, "default": ""}),
|
||||
"index": ("INT", {"default": 1, "min": 1, "max": 50, "step": 1}),
|
||||
"index": ("INT", {"default": 1, "min": 1, "max": 50, "step": 1}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,25 +22,35 @@ class TSC_Slider_Receiver_Standalone: # Keep class name for now, just update reg
|
||||
# Updated Category
|
||||
CATEGORY = "Dynamic Sliders Stack"
|
||||
|
||||
# ... (get_weight_at_index function remains the same) ...
|
||||
# Add compatibility attributes for newer ComfyUI versions
|
||||
TITLE = "Slider Receiver"
|
||||
TYPE = "Slider Receiver (DSS)"
|
||||
|
||||
# Add getWidgets method for consistency
|
||||
def getWidgets(self):
|
||||
# Just return all widgets since this node doesn't need filtering
|
||||
return self.widgets if hasattr(self, 'widgets') else None
|
||||
|
||||
def get_weight_at_index(self, weights_string, index):
|
||||
selected_weight = 0.0
|
||||
selected_weight = 0.0
|
||||
if not weights_string or not isinstance(weights_string, str):
|
||||
return (selected_weight,)
|
||||
try:
|
||||
weights_str_list = re.split(r'\s*,\s*', weights_string.strip())
|
||||
weights_str_list = [w for w in weights_str_list if w]
|
||||
|
||||
if 1 <= index <= len(weights_str_list):
|
||||
selected_weight = float(weights_str_list[index - 1])
|
||||
selected_weight_str = weights_str_list[index - 1]
|
||||
selected_weight = float(selected_weight_str)
|
||||
else:
|
||||
print(f"Warning: Index {index} out of bounds for weights string: '{weights_string}' (Length: {len(weights_str_list)}). Returning 0.0.")
|
||||
print(f"Warning: Index {index} out of bounds for weights list (Length: {len(weights_str_list)}). Returning 0.0.")
|
||||
except ValueError:
|
||||
print(f"Warning: Could not convert value to float in weights string: '{weights_string}' at index {index}. Returning 0.0.")
|
||||
except Exception as e:
|
||||
print(f"Error processing weights string '{weights_string}': {e}. Returning 0.0.")
|
||||
return (selected_weight,)
|
||||
|
||||
# --- Mappings ---
|
||||
# --- Mappings ---
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
RECEIVER_NODE_NAME: TSC_Slider_Receiver_Standalone
|
||||
}
|
||||
@@ -49,4 +58,4 @@ NODE_CLASS_MAPPINGS = {
|
||||
# Updated Display Name
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
RECEIVER_NODE_NAME: "Slider Receiver" # Removed suffix
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user