New Major version

This commit is contained in:
Isulion
2024-11-01 01:48:10 +01:00
parent e03010d557
commit 5fdd60bb35
13 changed files with 455 additions and 237 deletions
+1
View File
@@ -0,0 +1 @@
__pycache__
+26 -10
View File
@@ -6,26 +6,44 @@ ComfyUI Nodes that generate prompts with the help of LLM from local or remote Ol
--------------
# Requirement :
# Requirement:
Recomanded environnement variables :
Recommended environment variables:
- OLLAMA_KEEP_ALIVE 0
- OLLAMA_ORIGINS *
ComfyUI installed node :
ComfyUI installed node:
- Ollama_generator
# Installation :
# Installation:
- cd your_ComfyUI_install_dir
- cd custom_nodes
- git clone https://github.com/Isulion/ComfyUI_Isulion
--------------
# How to use :
# Available Nodes:
## Core Generators
- Isulion Prompt Generator ✨ - Main prompt generation node
- Isulion Ollama Generate 🤖 - LLM-based text generation
## Animal Related
- Isulion Animal Selector 🦁 - General animal selection
- Isulion Cute Animal Selector 🐱 - Cute and baby animal selection
- Isulion Animal Behavior Generator 🦊 - Animal actions and poses
## Environment
- Isulion Habitat Generator 🌲 - Natural environments and landscapes
- Isulion Weather Generator ⛅ - Weather conditions
- Isulion Time of Day Generator 🌅 - Time and lighting conditions
## Style and Mood
- Isulion Art Style Generator 🎨 - Artistic styles and techniques
- Isulion Emotion Generator 😊 - Emotional characteristics
# How to use:
Use this example workflow to get started:
@@ -36,6 +54,4 @@ Advanced Mode for More Flexibility:
![Example_Isulion_Workflow_Split](https://github.com/user-attachments/assets/e578ff7a-0c03-47a1-900f-a7e209a64914)
Chimere Animals Workflow
![workflowAnimals](https://github.com/user-attachments/assets/100cb116-c6ef-43cf-b5d3-d7782949ad9c)
# Chimera Animals Workflow:
+36 -20
View File
@@ -1,20 +1,36 @@
from .isulion_prompt_generator import IsulionPromptGenerator
from .isulion_OllamaGenerate import OllamaGenerate
from .isulion_animal_generator import IsulionAnimalRandom
from .isulion_cute_animal_generator import IsulionCuteAnimalRandom
NODE_CLASS_MAPPINGS = {
"IsulionPromptGenerator": IsulionPromptGenerator,
"OllamaGenerate": OllamaGenerate,
"AnimalGenerator": IsulionAnimalRandom,
"CuteAnimalGenerator": IsulionCuteAnimalRandom
}
# Optional: Provide a custom display name for the node
NODE_DISPLAY_NAME_MAPPINGS = {
"IsulionPromptGenerator": "Isulion Prompt Generator",
"OllamaGenerate": "Isulion Ollama Generate",
"AnimalGenerator": "Isulion Animal Selector",
"AnimalGenerator": "Isulion Cute Animal Selector"
}
from .isulion_prompt_generator import IsulionPromptGenerator
from .isulion_OllamaGenerate import OllamaGenerate
from .isulion_animal_generator import Isulion_AnimalRandom
from .isulion_cute_animal_generator import IsulionCuteAnimalRandom
from .isulion_emotion_generator import Isulion_EmotionGenerator
from .isulion_habitat_generator import Isulion_HabitatGenerator
from .isulion_weather_generator import Isulion_WeatherGenerator
from .isulion_time_of_day_generator import Isulion_TimeOfDayGenerator
from .isulion_art_style_generator import Isulion_ArtStyleGenerator
from .isulion_animal_behavior_generator import Isulion_AnimalBehaviorGenerator
NODE_CLASS_MAPPINGS = {
"IsulionPromptGenerator": IsulionPromptGenerator,
"IsulionOllamaGenerate": OllamaGenerate,
"IsulionAnimalRandom": Isulion_AnimalRandom,
"IsulionCuteAnimalRandom": IsulionCuteAnimalRandom,
"IsulionEmotionGenerator": Isulion_EmotionGenerator,
"IsulionHabitatGenerator": Isulion_HabitatGenerator,
"IsulionWeatherGenerator": Isulion_WeatherGenerator,
"IsulionTimeOfDayGenerator": Isulion_TimeOfDayGenerator,
"IsulionArtStyleGenerator": Isulion_ArtStyleGenerator,
"IsulionAnimalBehaviorGenerator": Isulion_AnimalBehaviorGenerator
}
NODE_DISPLAY_NAME_MAPPINGS = {
"IsulionPromptGenerator": "Isulion Prompt Generator ✨",
"IsulionOllamaGenerate": "Isulion Ollama Generate 🤖",
"IsulionAnimalRandom": "Isulion Animal Selector 🦁",
"IsulionCuteAnimalRandom": "Isulion Cute Animal Selector 🐱",
"IsulionEmotionGenerator": "Isulion Emotion Generator 😊",
"IsulionHabitatGenerator": "Isulion Habitat Generator 🌲",
"IsulionWeatherGenerator": "Isulion Weather Generator ⛅",
"IsulionTimeOfDayGenerator": "Isulion Time of Day Generator 🌅",
"IsulionArtStyleGenerator": "Isulion Art Style Generator 🎨",
"IsulionAnimalBehaviorGenerator": "Isulion Animal Behavior Generator 🦊"
}
+50 -50
View File
@@ -1,50 +1,50 @@
from ollama import Client
class OllamaGenerate:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"prompt": ("STRING", {
"multiline": True,
"default": "What is Art?"
}),
"url": ("STRING", {
"multiline": False,
"default": "http://127.0.0.1:11434"
}),
"model": ((), {}),
},
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("response",)
FUNCTION = "ollama_generate"
CATEGORY = "Ollama"
def ollama_generate(self, prompt, url, model):
# Keep_alive is now hardcoded to 0 (not visible to user)
keep_alive = 0
client = Client(host=url)
# Generate the response from the model
response = client.generate(
model=model,
prompt=prompt,
keep_alive=f"{keep_alive}m" # keep_alive is always 0
)
return (response['response'],)
# Register the node with your node mapping system
NODE_CLASS_MAPPINGS = {
"OllamaGenerate": OllamaGenerate,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"OllamaGenerate": "Ollama Generate",
}
from ollama import Client
class OllamaGenerate:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"prompt": ("STRING", {
"multiline": True,
"default": "What is Art?"
}),
"url": ("STRING", {
"multiline": False,
"default": "http://127.0.0.1:11434"
}),
"model": ((), {}),
},
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("response",)
FUNCTION = "ollama_generate"
CATEGORY = "Ollama"
def ollama_generate(self, prompt, url, model):
# Keep_alive is now hardcoded to 0 (not visible to user)
keep_alive = 0
client = Client(host=url)
# Generate the response from the model
response = client.generate(
model=model,
prompt=prompt,
keep_alive=f"{keep_alive}m" # keep_alive is always 0
)
return (response['response'],)
# Register the node with your node mapping system
NODE_CLASS_MAPPINGS = {
"OllamaGenerate": OllamaGenerate,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"OllamaGenerate": "Isulion Ollama Generate 🤖",
}
+43
View File
@@ -0,0 +1,43 @@
import random
from nodes import NODE_CLASS_MAPPINGS
class Isulion_AnimalBehaviorGenerator:
behaviors = [
'Hunting', 'Sleeping', 'Playing', 'Flying', 'Swimming', 'Running',
'Walking', 'Eating', 'Drinking', 'Grooming', 'Nesting', 'Perching',
'Climbing', 'Jumping', 'Diving', 'Stalking', 'Resting', 'Foraging',
'Grazing', 'Prowling', 'Pouncing', 'Soaring', 'Gliding', 'Hovering',
'Fishing', 'Basking', 'Burrowing', 'Hibernating', 'Migrating',
'Mating', 'Nurturing', 'Teaching', 'Fighting', 'Defending',
'Exploring', 'Hiding', 'Camouflaging', 'Gathering', 'Building',
'Communicating'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"behavior": (cls.behaviors,)
}
}
RETURN_TYPES = ("STRING", "INT",)
RETURN_NAMES = ("behavior", "seed",)
FUNCTION = "generate_behavior"
CATEGORY = "Art/Styles"
def generate_behavior(self, randomize, seed, behavior):
if randomize == "enable":
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
behavior = random.choice(self.behaviors)
return (f"{behavior}", seed)
# Remove NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS from here
+9 -46
View File
@@ -1,8 +1,7 @@
<<<<<<< HEAD
import random
from nodes import NODE_CLASS_MAPPINGS
class IsulionAnimalRandom:
class Isulion_AnimalRandom:
animals = [
'Dog','Cat','Horse','Cow','Chicken','Pig','Sheep','Goat','Lion','Tiger','Elephant','Bear','Wolf','Fox','Deer','Rabbit','Kangaroo','Giraffe','Zebra','Monkey','Chimpanzee','Gorilla','Orangutan','Panda','Koala','Hippopotamus','Rhinoceros','Crocodile','Alligator','Eagle','Hawk','Falcon','Owl','Penguin','Dolphin','Whale','Shark','Octopus','Squid','Jellyfish','Crab','Lobster','Clownfish','Sea Turtle','Frog','Toad','Snake','Lizard','Gecko','Tortoise','Camel','Donkey','Bat','Rat','Mouse','Squirrel','Chipmunk','Porcupine','Hedgehog','Skunk','Raccoon','Otter','Seal','Walrus','Polar Bear','Grizzly Bear','Cheetah','Leopard','Jaguar','Antelope','Buffalo','Bison','Moose','Reindeer','Mole','Platypus','Echidna','Parrot','Peacock','Swan','Duck','Goose','Turkey','Flamingo','Pelican','Seagull','Sparrow','Pigeon','Crow','Magpie','Woodpecker','Hummingbird','Butterfly','Bee','Ant','Spider','Scorpion','Worm','Snail','Slug'
]
@@ -17,7 +16,8 @@ class IsulionAnimalRandom:
}
}
RETURN_TYPES = ("Animal", "Seed",) # Two outputs: prompt string and seed
RETURN_TYPES = ("STRING", "INT",) # Two outputs: animal string and seed
RETURN_NAMES = ("animal", "seed",) # Names for the outputs
FUNCTION = "random_animal"
CATEGORY = "Art/Styles"
@@ -33,51 +33,14 @@ class IsulionAnimalRandom:
# Randomly select from predefined lists
animal = random.choice(self.animals)
return (f"{animal}\n", animal, seed)
return (f"{animal}", seed) # Return both the animal name and the seed
# Register the node with ComfyUI
NODE_CLASS_MAPPINGS.update({
"IsulionAnimalRandom": IsulionAnimalRandom
"IsulionAnimalRandom": Isulion_AnimalRandom
})
=======
import random
from nodes import NODE_CLASS_MAPPINGS
class IsulionAnimalRandom:
animals = [
'Dog','Cat','Horse','Cow','Chicken','Pig','Sheep','Goat','Lion','Tiger','Elephant','Bear','Wolf','Fox','Deer','Rabbit','Kangaroo','Giraffe','Zebra','Monkey','Chimpanzee','Gorilla','Orangutan','Panda','Koala','Hippopotamus','Rhinoceros','Crocodile','Alligator','Eagle','Hawk','Falcon','Owl','Penguin','Dolphin','Whale','Shark','Octopus','Squid','Jellyfish','Crab','Lobster','Clownfish','Sea Turtle','Frog','Toad','Snake','Lizard','Gecko','Tortoise','Camel','Donkey','Bat','Rat','Mouse','Squirrel','Chipmunk','Porcupine','Hedgehog','Skunk','Raccoon','Otter','Seal','Walrus','Polar Bear','Grizzly Bear','Cheetah','Leopard','Jaguar','Antelope','Buffalo','Bison','Moose','Reindeer','Mole','Platypus','Echidna','Parrot','Peacock','Swan','Duck','Goose','Turkey','Flamingo','Pelican','Seagull','Sparrow','Pigeon','Crow','Magpie','Woodpecker','Hummingbird','Butterfly','Bee','Ant','Spider','Scorpion','Worm','Snail','Slug'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"animal": (cls.animals,)
}
}
RETURN_TYPES = ("Animal", "Seed",) # Two outputs: prompt string and seed
FUNCTION = "random_animal"
CATEGORY = "Art/Styles"
def random_animal(self, randomize, seed, animal):
if randomize == "enable":
# Set seed for reproducibility if provided
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
# Randomly select from predefined lists
animal = random.choice(self.animals)
return (f"{animal}\n", animal, seed)
# Register the node with ComfyUI
NODE_CLASS_MAPPINGS.update({
"IsulionAnimalRandom": IsulionAnimalRandom
})
>>>>>>> 5eeae9531c3a965abf17b4d90ddd14ef8e64ed66
# At the end of the file, after NODE_CLASS_MAPPINGS
NODE_DISPLAY_NAME_MAPPINGS = {
"IsulionAnimalRandom": "Isulion Animal Selector 🦁"
}
+43
View File
@@ -0,0 +1,43 @@
import random
from nodes import NODE_CLASS_MAPPINGS
class Isulion_ArtStyleGenerator:
styles = [
'Realistic', 'Watercolor', 'Oil Painting', 'Sketch', 'Digital Art',
'Impressionism', 'Expressionism', 'Surrealism', 'Pop Art', 'Abstract',
'Minimalist', 'Comic Book', 'Manga', 'Anime', 'Pixel Art',
'Vector Art', 'Low Poly', '3D Rendering', 'Concept Art', 'Fantasy Art',
'Gothic', 'Baroque', 'Renaissance', 'Art Nouveau', 'Art Deco',
'Cubism', 'Pointillism', 'Photorealism', 'Hyperrealism', 'Naive Art',
'Folk Art', 'Street Art', 'Graffiti', 'Retro', 'Vintage',
'Steampunk', 'Cyberpunk', 'Vaporwave', 'Ukiyo-e', 'Chinese Painting'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"style": (cls.styles,)
}
}
RETURN_TYPES = ("STRING", "INT",)
RETURN_NAMES = ("style", "seed",)
FUNCTION = "generate_style"
CATEGORY = "Art/Styles"
def generate_style(self, randomize, seed, style):
if randomize == "enable":
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
style = random.choice(self.styles)
return (f"{style}", seed)
# Remove NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS from here
+3 -50
View File
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import random
from nodes import NODE_CLASS_MAPPINGS
@@ -17,7 +16,8 @@ class IsulionCuteAnimalRandom:
}
}
RETURN_TYPES = ("Animal", "Seed",) # Two outputs: prompt string and seed
RETURN_TYPES = ("STRING", "INT",) # Two outputs: animal string and seed
RETURN_NAMES = ("animal", "seed",) # Names for the outputs
FUNCTION = "random_animal"
CATEGORY = "Art/Styles"
@@ -33,51 +33,4 @@ class IsulionCuteAnimalRandom:
# Randomly select from predefined lists
animal = random.choice(self.animals)
return (f"{animal}\n", animal, seed)
# Register the node with ComfyUI
NODE_CLASS_MAPPINGS.update({
"IsulionCuteAnimalRandom": IsulionCuteAnimalRandom
})
=======
import random
from nodes import NODE_CLASS_MAPPINGS
class IsulionCuteAnimalRandom:
animals = [
'Red Panda','Koala','Fennec Fox','Pygmy Marmoset','Quokka','Sea Otter','Harp Seal Pup','Panda Cub','Penguin Chick','Hedgehog','Axolotl','Sloth','Rabbit','Kitten','Puppy','Meerkat','Sugar Glider','Chinchilla','Slow Loris','Hamster','Red Fox Kit','Lamb','Piglet','Duckling','Pygmy Hippo','Baby Giraffe','Baby Alpaca','Otter Pup','Corgi Puppy','Golden Retriever Puppy','Seal Pup','Snow Leopard Cub','Tiger Cub','Lion Cub','Baby Gorilla','Baby Orangutan','Pygmy Goat','Fawn (Baby Deer)','Ferret','Platypus','Kangaroo Joey','Wallaby','Dik-Dik','Serval Kitten','Caracal Kitten','Clouded Leopard Cub','Red Squirrel','Chipmunk','Prairie Dog','Arctic Fox','Polar Bear Cub','Bottlenose Dolphin Calf','Beluga Whale Calf','Manatee Calf','Baby Skunk','Raccoon Kit','Baby Opossum','Baby Echidna (Puggle)','Baby Tapir','GiantPanda Cub','Baby Hippo','Baby Rhino','Baby Zebra','Baby Elephant Seal','Baby Wombat','Baby Emu','Baby Kiwi Bird','Baby Flamingo','Cygnet (Baby Swan)','Baby Tortoise','Baby Alligator','Baby Crocodile','Baby Chameleon','Baby Iguana','Baby Frog','Baby Toad','Baby Gecko','Ring-tailed Lemur','Sifaka Lemur','Mouse Lemur','Bush Baby','PygmyPossum','Baby Mole','Baby Bat','Leveret (Baby Hare)','Baby Mole Rat','Baby Porcupine','Baby Badger','Pygmy Rabbit','Baby Seal','Baby Puffin','Owlet (Baby Owl)','Hoglet(Baby Hedgehog)','Baby Armadillo','Baby Pangolin','Baby Okapi','Baby Cheetah','Baby Ocelot','Baby Lynx','Baby Tasmanian Devil'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"animal": (cls.animals,)
}
}
RETURN_TYPES = ("Animal", "Seed",) # Two outputs: prompt string and seed
FUNCTION = "random_animal"
CATEGORY = "Art/Styles"
def random_animal(self, randomize, seed, animal):
if randomize == "enable":
# Set seed for reproducibility if provided
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
# Randomly select from predefined lists
animal = random.choice(self.animals)
return (f"{animal}\n", animal, seed)
# Register the node with ComfyUI
NODE_CLASS_MAPPINGS.update({
"IsulionCuteAnimalRandom": IsulionCuteAnimalRandom
})
>>>>>>> 5eeae9531c3a965abf17b4d90ddd14ef8e64ed66
return (f"{animal}", seed) # Return both the animal name and the seed
+55
View File
@@ -0,0 +1,55 @@
import random
from nodes import NODE_CLASS_MAPPINGS
class Isulion_EmotionGenerator:
emotions = [
'Happy', 'Sad', 'Angry', 'Excited', 'Nervous', 'Calm', 'Peaceful', 'Anxious',
'Joyful', 'Melancholic', 'Furious', 'Cheerful', 'Depressed', 'Enthusiastic',
'Frustrated', 'Content', 'Worried', 'Serene', 'Irritated', 'Ecstatic',
'Gloomy', 'Relaxed', 'Stressed', 'Satisfied', 'Disappointed', 'Proud',
'Scared', 'Confident', 'Shy', 'Jealous', 'Grateful', 'Lonely', 'Loved',
'Confused', 'Determined', 'Hopeful', 'Tired', 'Energetic', 'Bored',
'Surprised', 'Curious', 'Embarrassed', 'Guilty', 'Relief', 'Nostalgic'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"emotion": (cls.emotions,)
}
}
RETURN_TYPES = ("STRING", "STRING", "INT",) # Returns prompt string, emotion, and seed
RETURN_NAMES = ("prompt", "emotion", "seed",)
FUNCTION = "generate_emotion"
CATEGORY = "Art/Styles"
def generate_emotion(self, randomize, seed, emotion):
if randomize == "enable":
# Set seed for reproducibility if provided
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
# Randomly select emotion
emotion = random.choice(self.emotions)
# Create prompt with the emotion
prompt = f"feeling {emotion.lower()}, emotional"
return (prompt, emotion, seed)
# Register the node with ComfyUI
NODE_CLASS_MAPPINGS.update({
"IsulionEmotionGenerator": Isulion_EmotionGenerator
})
# At the end of the file, after NODE_CLASS_MAPPINGS
NODE_DISPLAY_NAME_MAPPINGS = {
"IsulionEmotionGenerator": "Isulion Emotion Generator 😊"
}
+42
View File
@@ -0,0 +1,42 @@
import random
from nodes import NODE_CLASS_MAPPINGS
class Isulion_HabitatGenerator:
habitats = [
'Jungle', 'Rainforest', 'Savanna', 'Desert', 'Arctic Tundra', 'Ocean', 'Coral Reef',
'Mountain Range', 'Alpine Forest', 'Grassland', 'Wetland', 'Mangrove Swamp',
'Deciduous Forest', 'Coniferous Forest', 'Rocky Shore', 'Sandy Beach', 'Cave System',
'River Valley', 'Lake Shore', 'Bamboo Forest', 'Salt Marsh', 'Kelp Forest',
'Volcanic Region', 'Coastal Cliff', 'Prairie', 'Steppe', 'Taiga', 'Deep Ocean',
'Shallow Reef', 'Underground Cave', 'Hot Spring', 'Oasis', 'Canyon', 'Delta',
'Estuary', 'Fjord', 'Glacier', 'Ice Sheet', 'Island', 'Peninsula'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"habitat": (cls.habitats,)
}
}
RETURN_TYPES = ("STRING", "INT",)
RETURN_NAMES = ("habitat", "seed",)
FUNCTION = "generate_habitat"
CATEGORY = "Art/Styles"
def generate_habitat(self, randomize, seed, habitat):
if randomize == "enable":
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
habitat = random.choice(self.habitats)
return (f"{habitat}", seed)
# Remove NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS from here
File diff suppressed because one or more lines are too long
+41
View File
@@ -0,0 +1,41 @@
import random
from nodes import NODE_CLASS_MAPPINGS
class Isulion_TimeOfDayGenerator:
times = [
'Dawn', 'Sunrise', 'Early Morning', 'Morning', 'Late Morning', 'Noon',
'Early Afternoon', 'Afternoon', 'Late Afternoon', 'Golden Hour',
'Sunset', 'Dusk', 'Twilight', 'Evening', 'Night', 'Midnight',
'Blue Hour', 'First Light', 'Magic Hour', 'Civil Twilight',
'Astronomical Twilight', 'Nautical Twilight', 'Witching Hour',
'Pre-dawn', 'Post-sunset'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"time": (cls.times,)
}
}
RETURN_TYPES = ("STRING", "INT",)
RETURN_NAMES = ("time", "seed",)
FUNCTION = "generate_time"
CATEGORY = "Art/Styles"
def generate_time(self, randomize, seed, time):
if randomize == "enable":
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
time = random.choice(self.times)
return (f"{time}", seed)
# Remove NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS from here
+41
View File
@@ -0,0 +1,41 @@
import random
from nodes import NODE_CLASS_MAPPINGS
class Isulion_WeatherGenerator:
weather_conditions = [
'Sunny', 'Cloudy', 'Partly Cloudy', 'Overcast', 'Rainy', 'Heavy Rain',
'Thunderstorm', 'Lightning Storm', 'Snowy', 'Blizzard', 'Foggy', 'Misty',
'Clear Sky', 'Stormy', 'Windy', 'Breezy', 'Hazy', 'Dusty', 'Sandstorm',
'Drizzle', 'Sleet', 'Hail', 'Rainbow', 'Double Rainbow', 'Aurora Borealis',
'Heat Wave', 'Humid', 'Dry', 'Frost', 'Ice Storm', 'Tornado', 'Hurricane',
'Tropical Storm', 'Monsoon', 'Clear Night', 'Starry Night'
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"randomize": (["enable", "disable"],),
"seed": ("INT", {"default": 0, "min": 0, "max": 999999999}),
"weather": (cls.weather_conditions,)
}
}
RETURN_TYPES = ("STRING", "INT",)
RETURN_NAMES = ("weather", "seed",)
FUNCTION = "generate_weather"
CATEGORY = "Art/Styles"
def generate_weather(self, randomize, seed, weather):
if randomize == "enable":
if seed is not None and seed > 0:
random.seed(seed)
else:
seed = random.randint(0, 999999999)
random.seed(seed)
weather = random.choice(self.weather_conditions)
return (f"{weather}", seed)
# Remove NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS from here