| 24 | log = logging.getLogger(__name__) # Fallback to standard logging |
| 25 | |
| 26 | class BatchCreativeInterpolationNode: |
| 27 | @classmethod |
| 28 | def IS_CHANGED(cls, **kwargs): |
| 29 | return float("NaN") |
| 30 | |
| 31 | @classmethod |
| 32 | def INPUT_TYPES(s): |
| 33 | return { |
| 34 | "required": { |
| 35 | "positive": ("CONDITIONING", ), |
| 36 | "negative": ("CONDITIONING", ), |
| 37 | "images": ("IMAGE", ), |
| 38 | "model": ("MODEL", ), |
| 39 | "ipadapter": ("IPADAPTER", ), |
| 40 | "clip_vision": ("CLIP_VISION",), |
| 41 | "type_of_frame_distribution": (["linear", "dynamic"],), |
| 42 | "linear_frame_distribution_value": ("INT", {"default": 16, "min": 4, "max": 64, "step": 1}), |
| 43 | "dynamic_frame_distribution_values": ("STRING", {"multiline": True, "default": "0,10,26,40"}), |
| 44 | "type_of_key_frame_influence": (["linear", "dynamic"],), |
| 45 | "linear_key_frame_influence_value": ("STRING", {"multiline": False, "default": "(1.0,1.0)"}), |
| 46 | "dynamic_key_frame_influence_values": ("STRING", {"multiline": True, "default": "(1.0,1.0),(1.0,1.5)(1.0,0.5)"}), |
| 47 | "type_of_strength_distribution": (["linear", "dynamic"],), |
| 48 | "linear_strength_value": ("STRING", {"multiline": False, "default": "(0.3,0.4)"}), |
| 49 | "dynamic_strength_values": ("STRING", {"multiline": True, "default": "(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0)"}), |
| 50 | "buffer": ("INT", {"default": 4, "min": 1, "max": 16, "step": 1}), |
| 51 | "high_detail_mode": ("BOOLEAN", {"default": True}), |
| 52 | }, |
| 53 | "optional": { |
| 54 | "base_ipa_advanced_settings": ("ADVANCED_IPA_SETTINGS",), |
| 55 | "detail_ipa_advanced_settings": ("ADVANCED_IPA_SETTINGS",), |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | RETURN_TYPES = ("IMAGE","CONDITIONING","CONDITIONING","MODEL","STRING","INT", "INT", "STRING") |
| 60 | RETURN_NAMES = ("GRAPH","POSITIVE","NEGATIVE","MODEL","KEYFRAME_POSITIONS","BATCH_SIZE", "BUFFER","FRAMES_TO_DROP") |
| 61 | FUNCTION = "combined_function" |
| 62 | |
| 63 | CATEGORY = "Steerable-Motion" |
| 64 | |
| 65 | def combined_function(self,positive,negative,images,model,ipadapter,clip_vision, |
| 66 | type_of_frame_distribution,linear_frame_distribution_value, |
| 67 | dynamic_frame_distribution_values, type_of_key_frame_influence,linear_key_frame_influence_value, |
| 68 | dynamic_key_frame_influence_values,type_of_strength_distribution, |
| 69 | linear_strength_value,dynamic_strength_values, |
| 70 | buffer, high_detail_mode,base_ipa_advanced_settings=None, |
| 71 | detail_ipa_advanced_settings=None): |
| 72 | # set the matplotlib backend to 'Agg' to prevent crash on macOS |
| 73 | # 'Agg' is a non-interactive backend that can be used in a non-main thread |
| 74 | matplotlib.use('Agg') |
| 75 | |
| 76 | def get_keyframe_positions(type_of_frame_distribution, dynamic_frame_distribution_values, images, linear_frame_distribution_value): |
| 77 | if type_of_frame_distribution == "dynamic": |
| 78 | # Check if the input is a string or a list |
| 79 | if isinstance(dynamic_frame_distribution_values, str): |
| 80 | # Parse the keyframe positions, sort them, and then increase each by 1 except the first |
| 81 | keyframes = sorted([int(kf.strip()) for kf in dynamic_frame_distribution_values.split(',')]) |
| 82 | elif isinstance(dynamic_frame_distribution_values, list): |
| 83 | # Sort the list and then increase each by 1 except the first |
nothing calls this directly
no outgoing calls
no test coverage detected