New theme, Creation guide and Analysis update
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"config_version": "1.1",
|
||||
"space_colony": {
|
||||
"metadata": {
|
||||
"version": "1.1",
|
||||
"author": "Isulion",
|
||||
"last_updated": "2024-06-10"
|
||||
},
|
||||
"main_elements": [
|
||||
"dome habitat",
|
||||
"hydroponic farm",
|
||||
"command center",
|
||||
"solar array",
|
||||
"terraforming module",
|
||||
"robotics lab",
|
||||
"spaceport",
|
||||
"biodome",
|
||||
"mining rig",
|
||||
"energy shield",
|
||||
"observation tower"
|
||||
],
|
||||
"settings": [
|
||||
"lunar surface",
|
||||
"Martian desert",
|
||||
"asteroid belt",
|
||||
"orbiting space station",
|
||||
"icy moon",
|
||||
"Europa's ocean",
|
||||
"Titan's methane lakes",
|
||||
"Ceres outpost",
|
||||
"deep space",
|
||||
"binary star system"
|
||||
],
|
||||
"flora": [
|
||||
"alien vegetation",
|
||||
"bioluminescent plants",
|
||||
"engineered crops",
|
||||
"moss gardens",
|
||||
"oxygen-producing algae"
|
||||
],
|
||||
"inhabitants": [
|
||||
"astronauts",
|
||||
"robotic workers",
|
||||
"scientists",
|
||||
"engineers",
|
||||
"alien visitors"
|
||||
],
|
||||
"activities": [
|
||||
"spacewalk",
|
||||
"terraforming",
|
||||
"mineral extraction",
|
||||
"scientific research",
|
||||
"zero-gravity sports"
|
||||
],
|
||||
"styles": [
|
||||
"sleek futuristic",
|
||||
"brutalist architecture",
|
||||
"biophilic design",
|
||||
"retro sci-fi",
|
||||
"high-tech minimalism",
|
||||
"modular construction",
|
||||
"transparent structures"
|
||||
],
|
||||
"effects": [
|
||||
"glowing neon lights",
|
||||
"dust storms",
|
||||
"starfield backdrop",
|
||||
"artificial gravity",
|
||||
"transparent domes",
|
||||
"solar flares",
|
||||
"meteor shower",
|
||||
"aurora borealis",
|
||||
"force fields"
|
||||
],
|
||||
"technologies": [
|
||||
"fusion reactor",
|
||||
"AI control systems",
|
||||
"quantum computers",
|
||||
"holographic displays",
|
||||
"gravity generators"
|
||||
],
|
||||
"lighting_conditions": [
|
||||
"harsh sunlight",
|
||||
"soft blue glow",
|
||||
"emergency lighting",
|
||||
"twilight",
|
||||
"starlit night"
|
||||
],
|
||||
"nature_techniques": [
|
||||
"focus stacking",
|
||||
"long exposure",
|
||||
"HDR photography",
|
||||
"macro photography"
|
||||
],
|
||||
"nature_effects": [
|
||||
"atmospheric haze",
|
||||
"light rays",
|
||||
"water reflections",
|
||||
"natural textures"
|
||||
],
|
||||
"defaults": {
|
||||
"fallback_category": "main_elements",
|
||||
"min_items": 1,
|
||||
"max_items": 14
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"space_colony": {
|
||||
"main_elements": [
|
||||
"dome habitat",
|
||||
"hydroponic farm",
|
||||
"command center",
|
||||
"solar array",
|
||||
"terraforming module"
|
||||
],
|
||||
"settings": [
|
||||
"lunar surface",
|
||||
"Martian desert",
|
||||
"asteroid belt",
|
||||
"orbiting space station",
|
||||
"icy moon"
|
||||
],
|
||||
"styles": [
|
||||
"sleek futuristic",
|
||||
"brutalist architecture",
|
||||
"biophilic design",
|
||||
"retro sci-fi",
|
||||
"high-tech minimalism"
|
||||
],
|
||||
"effects": [
|
||||
"glowing neon lights",
|
||||
"dust storms",
|
||||
"starfield backdrop",
|
||||
"artificial gravity",
|
||||
"transparent domes"
|
||||
]
|
||||
},
|
||||
"tropical_paradise": {
|
||||
"main_elements": ["beach", "lagoon", "island", "waterfall", "coral reef"],
|
||||
"flora": ["orchids", "hibiscus", "plumeria", "bamboo", "palm trees", "banana trees"],
|
||||
"fauna": ["parrots", "tropical fish", "sea turtles", "butterflies", "monkeys"],
|
||||
"features": ["palm trees", "rock formations", "tide pools", "flowering vines"],
|
||||
"settings": ["secluded island", "beach cove", "lagoon", "coral reef", "tropical forest"],
|
||||
"water": ["crystal-clear water", "turquoise sea", "gentle waves", "shallow lagoon"],
|
||||
"sand": ["white sand beach", "golden sand", "powdery shore"],
|
||||
"weather": ["sunny", "golden hour", "clear sky", "gentle breeze", "tropical rain"],
|
||||
"times": ["sunrise", "sunset", "midday", "dusk"],
|
||||
"styles": ["vivid color palette", "photorealistic", "impressionist", "watercolor"],
|
||||
"techniques": ["soft focus", "high saturation", "cinematic lighting", "macro detail"],
|
||||
"effects": ["sunbeams", "lens flare", "bokeh", "water reflections", "misty haze"],
|
||||
"patterns": ["rippling water", "leaf shadows", "sand patterns", "cloud reflections"]
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,8 @@ HANDLER_CLASS_NAMES_MAP = {
|
||||
"vintage_anthropomorphic": "VintageAnthropomorphicThemeHandler",
|
||||
"watercolor": "WatercolorThemeHandler",
|
||||
"starter_pack": "StarterPackThemeHandler",
|
||||
"space_colony": "SpaceColonyHandler",
|
||||
"tropical_paradise": "TropicalParadiseThemeHandler",
|
||||
# Removed duplicates that were in your original list
|
||||
}
|
||||
|
||||
@@ -287,7 +289,9 @@ class ThemeRegistry:
|
||||
"📸 Vintage 1800s Photography": "vintage_1800s_photography",
|
||||
"👴 Vintage Anthropomorphic": "vintage_anthropomorphic",
|
||||
"🎨 Watercolor": "watercolor",
|
||||
"🧸 Starter Pack": "starter_pack"
|
||||
"🧸 Starter Pack": "starter_pack",
|
||||
"🚀 Space Colony": "space_colony",
|
||||
"🏝️ Tropical Paradise": "tropical_paradise"
|
||||
}
|
||||
|
||||
available_internal_names = set(self.handlers.keys()).union({"random"})
|
||||
@@ -456,6 +460,14 @@ class IsulionMegaPromptV3:
|
||||
"", "", "", "",
|
||||
return_seed
|
||||
)
|
||||
else:
|
||||
# Always show the display name for the selected theme
|
||||
for display_name, internal_name in self.theme_registry.theme_mappings.items():
|
||||
if internal_name == internal_theme:
|
||||
selected_theme_display = display_name
|
||||
break
|
||||
else:
|
||||
selected_theme_display = internal_theme # fallback
|
||||
|
||||
handler = self.theme_registry.get_handler(internal_theme)
|
||||
if self.debug_mode:
|
||||
|
||||
@@ -69,6 +69,7 @@ from .puzzle_dimension_handler import PuzzleDimensionThemeHandler
|
||||
from .school_manga_handler import SchoolMangaThemeHandler
|
||||
from .selfie_handler import SelfieThemeHandler
|
||||
from .skinny_blonde_girl_handler import SkinnyBlondeGirlHandler
|
||||
from .space_colony_handler import SpaceColonyHandler
|
||||
from .street_food_kebab_handler import StreetFoodKebabThemeHandler
|
||||
from .underwater_civilization_handler import UnderwaterCivilizationThemeHandler
|
||||
from .urban_tag_handler import UrbanTagThemeHandler
|
||||
@@ -77,6 +78,7 @@ from .vintage_anthropomorphic_handler import VintageAnthropomorphicThemeHandler
|
||||
from .vintage_1800s_photography_handler import Vintage1800sPhotographyHandler
|
||||
from .historical_monuments_handler import HistoricalMonumentsHandler
|
||||
from .medieval_handler import MedievalThemeHandler
|
||||
from .tropical_paradise_handler import TropicalParadiseThemeHandler
|
||||
|
||||
# Holiday and Event Handlers
|
||||
from .chinese_new_year_handler import ChineseNewYearThemeHandler
|
||||
@@ -132,11 +134,11 @@ __all__ = [
|
||||
'LogoThemeHandler', 'MangaPanelThemeHandler', 'MicroscopicThemeHandler',
|
||||
'PeakyBlindersThemeHandler', 'PostApocalypticThemeHandler',
|
||||
'PuzzleDimensionThemeHandler', 'SchoolMangaThemeHandler',
|
||||
'SelfieThemeHandler', 'SkinnyBlondeGirlHandler', 'StreetFoodKebabThemeHandler',
|
||||
'UnderwaterCivilizationThemeHandler', 'UrbanTagThemeHandler',
|
||||
'VillageWorldThemeHandler', 'VintageAnthropomorphicThemeHandler',
|
||||
'SelfieThemeHandler', 'SkinnyBlondeGirlHandler', 'SpaceColonyHandler',
|
||||
'StreetFoodKebabThemeHandler', 'UnderwaterCivilizationThemeHandler',
|
||||
'UrbanTagThemeHandler', 'VillageWorldThemeHandler', 'VintageAnthropomorphicThemeHandler',
|
||||
'Vintage1800sPhotographyHandler', 'HistoricalMonumentsHandler',
|
||||
'MedievalThemeHandler',
|
||||
'MedievalThemeHandler', 'TropicalParadiseThemeHandler',
|
||||
|
||||
# Holiday and Event Handlers
|
||||
'ChineseNewYearThemeHandler', 'ChristmasThemeHandler',
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
from typing import Dict
|
||||
from .base_handler import BaseThemeHandler
|
||||
import random
|
||||
|
||||
class SpaceColonyHandler(BaseThemeHandler):
|
||||
"""Handler for the Space Colony theme."""
|
||||
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
self.theme_config = config.get_config("space_colony")
|
||||
|
||||
def _get_random(self, key, fallback=None):
|
||||
values = self.theme_config.get(key, [])
|
||||
if values:
|
||||
return random.choice(values)
|
||||
return fallback or ""
|
||||
|
||||
def generate(
|
||||
self,
|
||||
custom_subject: str = "",
|
||||
custom_location: str = "",
|
||||
include_environment: bool = True,
|
||||
include_style: bool = True,
|
||||
include_effects: bool = True
|
||||
) -> Dict[str, str]:
|
||||
"""Generates prompt components for the Space Colony theme."""
|
||||
|
||||
cfg = self.theme_config
|
||||
components = {}
|
||||
|
||||
# Subject
|
||||
main_element = self._get_random("main_elements", "dome habitat")
|
||||
subject_parts = []
|
||||
|
||||
if custom_subject:
|
||||
subject_parts.append(f"space colony {custom_subject}")
|
||||
else:
|
||||
subject_parts.append(f"space colony {main_element}")
|
||||
|
||||
# Always add inhabitants, flora, activities, technologies if present and non-empty
|
||||
for key in ["inhabitants", "flora", "activities", "technologies"]:
|
||||
if key in cfg:
|
||||
value = self._get_random(key)
|
||||
if value:
|
||||
subject_parts.append(value)
|
||||
|
||||
# Optionally add nature photography technique
|
||||
if "nature_techniques" in cfg and random.random() < 0.5:
|
||||
technique = self._get_random("nature_techniques")
|
||||
if technique:
|
||||
subject_parts.append(f"{technique} technique")
|
||||
|
||||
components["subject"] = ", ".join(f"(({part}))" for part in subject_parts)
|
||||
|
||||
# Environment
|
||||
if include_environment:
|
||||
if custom_location:
|
||||
env = f"space environment {custom_location}"
|
||||
else:
|
||||
env = self._get_random("settings", "Martian desert")
|
||||
# Optionally add lighting
|
||||
if "lighting_conditions" in cfg and random.random() < 0.5:
|
||||
lighting = self._get_random("lighting_conditions")
|
||||
env = f"{env}, {lighting}"
|
||||
components["environment"] = f"in (({env}))"
|
||||
|
||||
# Style
|
||||
if include_style:
|
||||
style = self._get_random("styles", "sleek futuristic")
|
||||
style_str = f"in the style of (({style}))"
|
||||
# Optionally add nature photography style
|
||||
if "nature_techniques" in cfg and random.random() < 0.5:
|
||||
technique = self._get_random("nature_techniques")
|
||||
style_str += f", ((hyper-realistic nature photography)), (({technique}))"
|
||||
components["style"] = style_str
|
||||
|
||||
# Effects
|
||||
if include_effects:
|
||||
effect = self._get_random("effects", "starfield backdrop")
|
||||
effects_str = f"with (({effect}))"
|
||||
# Optionally add nature effect
|
||||
if "nature_effects" in cfg and random.random() < 0.7:
|
||||
nature_effect = self._get_random("nature_effects")
|
||||
effects_str += f", (({nature_effect}))"
|
||||
components["effects"] = effects_str
|
||||
|
||||
return components
|
||||
@@ -0,0 +1,87 @@
|
||||
from typing import Dict
|
||||
from .base_handler import BaseThemeHandler
|
||||
import random
|
||||
|
||||
class TropicalParadiseThemeHandler(BaseThemeHandler):
|
||||
"""Handler for tropical paradise-themed prompt generation."""
|
||||
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
self.theme_config = config.get_config("tropical_paradise")
|
||||
|
||||
def _get_random(self, key, fallback=None):
|
||||
try:
|
||||
values = self.theme_config.get(key, [])
|
||||
if values:
|
||||
return random.choice(values)
|
||||
if fallback is not None:
|
||||
return fallback
|
||||
except Exception:
|
||||
pass
|
||||
return fallback or "tropical"
|
||||
|
||||
def generate(self, custom_subject: str = "",
|
||||
custom_location: str = "",
|
||||
include_environment: bool = True,
|
||||
include_style: bool = True,
|
||||
include_effects: bool = True) -> Dict[str, str]:
|
||||
"""Generate tropical paradise-themed components."""
|
||||
components = {}
|
||||
|
||||
# Subject
|
||||
flora = self._get_random("flora", "orchids")
|
||||
fauna = self._get_random("fauna", "parrots")
|
||||
feature = self._get_random("features", "palm trees")
|
||||
if custom_subject:
|
||||
components["subject"] = (
|
||||
f"((tropical paradise {custom_subject})), "
|
||||
f"((lush {flora})), ((vivid {fauna})), (({feature})), "
|
||||
f"((idyllic setting)), ((paradise atmosphere))"
|
||||
)
|
||||
else:
|
||||
main = self._get_random("main_elements", "beach")
|
||||
components["subject"] = (
|
||||
f"((tropical paradise with {main})), "
|
||||
f"((lush {flora})), ((vivid {fauna})), (({feature})), "
|
||||
f"((idyllic setting)), ((paradise atmosphere))"
|
||||
)
|
||||
|
||||
# Environment
|
||||
if include_environment:
|
||||
water = self._get_random("water", "crystal-clear water")
|
||||
sand = self._get_random("sand", "white sand beach")
|
||||
weather = self._get_random("weather", "sunny")
|
||||
time = self._get_random("times", "sunset")
|
||||
if custom_location:
|
||||
components["environment"] = (
|
||||
f"in (({custom_location})), (({water})), (({sand})), "
|
||||
f"(({weather})), (({time})), ((serene horizon)), ((paradise environment))"
|
||||
)
|
||||
else:
|
||||
setting = self._get_random("settings", "secluded island")
|
||||
components["environment"] = (
|
||||
f"in (({setting})), (({water})), (({sand})), "
|
||||
f"(({weather})), (({time})), ((serene horizon)), ((paradise environment))"
|
||||
)
|
||||
|
||||
# Style
|
||||
if include_style:
|
||||
style = self._get_random("styles", "vivid color palette")
|
||||
technique = self._get_random("techniques", "soft focus")
|
||||
components["style"] = (
|
||||
f"((rendered in {style} style)), ((using {technique} technique)), "
|
||||
f"((artistic composition)), ((perfect exposure)), ((professional quality)), "
|
||||
f"((vibrant colors)), ((dreamlike atmosphere))"
|
||||
)
|
||||
|
||||
# Effects
|
||||
if include_effects:
|
||||
effect = self._get_random("effects", "sunbeams")
|
||||
pattern = self._get_random("patterns", "rippling water")
|
||||
components["effects"] = (
|
||||
f"with (({effect})), (({pattern})), "
|
||||
f"((atmospheric haze)), ((glowing highlights)), "
|
||||
f"((tropical ambiance)), ((paradise effect))"
|
||||
)
|
||||
|
||||
return components
|
||||
+191
-32
@@ -23,6 +23,7 @@ ComfyUI/
|
||||
1. **Handler filename**: `Core_Nodes/theme_handlers/your_theme_handler.py` (no double underscores).
|
||||
2. **Config filename**: `Core_Nodes/configs/your_theme.json`.
|
||||
3. Use **consistent internal names** (`your_theme`) across all files. This is crucial for linking the handler, config, and UI elements.
|
||||
4. **Handler class name and config key must match the internal name** (e.g., `YourThemeHandler` for `your_theme`).
|
||||
|
||||
---
|
||||
|
||||
@@ -30,7 +31,8 @@ ComfyUI/
|
||||
|
||||
- [ ] Handler file: `your_theme_handler.py`
|
||||
- [ ] Config file: `your_theme.json`
|
||||
- [ ] Import in `theme_handlers/__init__.py`
|
||||
- [ ] Import in `theme_handlers/__init__.py`
|
||||
_Example:_ `from .your_theme_handler import YourThemeHandler`
|
||||
- [ ] Registration in `mega_prompt_V3.py`
|
||||
|
||||
---
|
||||
@@ -47,35 +49,50 @@ from .base_handler import BaseThemeHandler
|
||||
class YourThemeHandler(BaseThemeHandler):
|
||||
"""Handler for your custom theme."""
|
||||
|
||||
def generate(self,
|
||||
custom_subject: str = "",
|
||||
custom_location: str = "",
|
||||
include_environment: str = "yes",
|
||||
include_style: str = "yes",
|
||||
include_effects: str = "yes") -> Dict[str, str]:
|
||||
def generate(
|
||||
self,
|
||||
custom_subject: str = "",
|
||||
custom_location: str = "",
|
||||
include_environment: bool = True,
|
||||
include_style: bool = True,
|
||||
include_effects: bool = True
|
||||
) -> Dict[str, str]:
|
||||
"""Generates prompt components for the theme."""
|
||||
|
||||
components = {}
|
||||
|
||||
# Required: Subject generation
|
||||
# Subject
|
||||
if custom_subject:
|
||||
components["subject"] = (
|
||||
f"((themed {custom_subject})), "
|
||||
f"((main attribute)), ((supporting detail))"
|
||||
f"((themed {custom_subject})), ((main attribute)), ((supporting detail))"
|
||||
)
|
||||
else:
|
||||
main_element = self._get_random_choice("your_theme.main_elements")
|
||||
components["subject"] = f"((themed {main_element})), ((supporting detail))"
|
||||
|
||||
# Optional: Environment
|
||||
if include_environment == "yes":
|
||||
setting = self._get_random_choice("your_theme.settings")
|
||||
components["environment"] = f"in ((themed {setting}))"
|
||||
# Environment
|
||||
if include_environment:
|
||||
if custom_location:
|
||||
components["environment"] = f"in ((themed {custom_location}))"
|
||||
else:
|
||||
setting = self._get_random_choice("your_theme.settings")
|
||||
components["environment"] = f"in ((themed {setting}))"
|
||||
else:
|
||||
components["environment"] = ""
|
||||
|
||||
# Optional: Style (example - expand as needed)
|
||||
if include_style == "yes":
|
||||
# Style
|
||||
if include_style:
|
||||
style = self._get_random_choice("your_theme.styles")
|
||||
components["style"] = f"in the style of ((themed {style}))"
|
||||
else:
|
||||
components["style"] = ""
|
||||
|
||||
# Effects
|
||||
if include_effects:
|
||||
effect = self._get_random_choice("your_theme.effects")
|
||||
components["effects"] = f"with ((themed {effect}))"
|
||||
else:
|
||||
components["effects"] = ""
|
||||
|
||||
return components
|
||||
```
|
||||
@@ -85,19 +102,10 @@ class YourThemeHandler(BaseThemeHandler):
|
||||
```json
|
||||
{
|
||||
"your_theme": {
|
||||
"main_elements": [
|
||||
"example1",
|
||||
"example2"
|
||||
],
|
||||
"settings": [
|
||||
"settingA",
|
||||
"settingB"
|
||||
],
|
||||
"styles": [
|
||||
"art nouveau",
|
||||
"cyberpunk",
|
||||
"impressionism"
|
||||
]
|
||||
"main_elements": ["example1", "example2"],
|
||||
"settings": ["settingA", "settingB"],
|
||||
"styles": ["art nouveau", "cyberpunk"],
|
||||
"effects": ["soft lighting", "dramatic shadows"]
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -123,26 +131,176 @@ def _init_mappings(self):
|
||||
|
||||
---
|
||||
|
||||
## Example: 🚀 Space Colony Theme
|
||||
|
||||
### Handler File
|
||||
|
||||
```python
|
||||
# filepath: Core_Nodes/theme_handlers/space_colony_handler.py
|
||||
from typing import Dict
|
||||
from .base_handler import BaseThemeHandler
|
||||
|
||||
class SpaceColonyHandler(BaseThemeHandler):
|
||||
"""Handler for the Space Colony theme."""
|
||||
|
||||
def generate(
|
||||
self,
|
||||
custom_subject: str = "",
|
||||
custom_location: str = "",
|
||||
include_environment: bool = True,
|
||||
include_style: bool = True,
|
||||
include_effects: bool = True
|
||||
) -> Dict[str, str]:
|
||||
"""Generates prompt components for the Space Colony theme."""
|
||||
|
||||
components = {}
|
||||
|
||||
# Subject
|
||||
if custom_subject:
|
||||
components["subject"] = (
|
||||
f"((space colony {custom_subject})), ((main structure)), ((supporting detail))"
|
||||
)
|
||||
else:
|
||||
main_element = self._get_random_choice("space_colony.main_elements")
|
||||
components["subject"] = f"((space colony {main_element})), ((supporting detail))"
|
||||
|
||||
# Environment
|
||||
if include_environment:
|
||||
if custom_location:
|
||||
components["environment"] = f"in ((space environment {custom_location}))"
|
||||
else:
|
||||
setting = self._get_random_choice("space_colony.settings")
|
||||
components["environment"] = f"in ((space environment {setting}))"
|
||||
else:
|
||||
components["environment"] = ""
|
||||
|
||||
# Style
|
||||
if include_style:
|
||||
style = self._get_random_choice("space_colony.styles")
|
||||
components["style"] = f"in the style of (({style}))"
|
||||
else:
|
||||
components["style"] = ""
|
||||
|
||||
# Effects
|
||||
if include_effects:
|
||||
effect = self._get_random_choice("space_colony.effects")
|
||||
components["effects"] = f"with (({effect}))"
|
||||
else:
|
||||
components["effects"] = ""
|
||||
|
||||
return components
|
||||
```
|
||||
|
||||
### Config File
|
||||
|
||||
```json
|
||||
{
|
||||
"space_colony": {
|
||||
"main_elements": [
|
||||
"dome habitat",
|
||||
"hydroponic farm",
|
||||
"command center",
|
||||
"solar array",
|
||||
"terraforming module"
|
||||
],
|
||||
"settings": [
|
||||
"lunar surface",
|
||||
"Martian desert",
|
||||
"asteroid belt",
|
||||
"orbiting space station",
|
||||
"icy moon"
|
||||
],
|
||||
"styles": [
|
||||
"sleek futuristic",
|
||||
"brutalist architecture",
|
||||
"biophilic design",
|
||||
"retro sci-fi",
|
||||
"high-tech minimalism"
|
||||
],
|
||||
"effects": [
|
||||
"glowing neon lights",
|
||||
"dust storms",
|
||||
"starfield backdrop",
|
||||
"artificial gravity",
|
||||
"transparent domes"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Registration in `mega_prompt_V3.py`
|
||||
|
||||
```python
|
||||
def _init_handlers(self):
|
||||
handler_classes = {
|
||||
# ...existing handlers...
|
||||
"space_colony": SpaceColonyHandler,
|
||||
}
|
||||
|
||||
def _init_mappings(self):
|
||||
emoji_mappings = {
|
||||
# ...existing mappings...
|
||||
"🚀 Space Colony": "space_colony"
|
||||
}
|
||||
```
|
||||
|
||||
### Import in `theme_handlers/__init__.py`
|
||||
|
||||
```python
|
||||
from .space_colony_handler import SpaceColonyHandler
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Errors & Solutions
|
||||
|
||||
1. **"Handler not found" error:**
|
||||
- Double-check the handler filename (no double underscores).
|
||||
- Verify the import statement in `theme_handlers/__init__.py` (e.g., `from .your_theme_handler import YourThemeHandler`).
|
||||
- Ensure the handler is correctly registered in `_init_handlers` in `mega_prompt_V3.py`.
|
||||
- **If you see a Python import error:** Check for typos or missing files in the `theme_handlers` directory.
|
||||
|
||||
2. **"Config not found" error:**
|
||||
- Ensure the config file is named `your_theme.json`.
|
||||
- Verify the file is located in the `Core_Nodes/configs/` directory.
|
||||
- Remove any JSON comments or trailing commas. JSON is strict!
|
||||
- Remove any JSON comments or trailing commas. **JSON is strict!**
|
||||
_Tip: Use a JSON validator if unsure._
|
||||
|
||||
3. **"Theme not appearing" error:**
|
||||
- Check `_init_handlers` and `_init_mappings` in `mega_prompt_V3.py` for correct registration.
|
||||
- Restart ComfyUI after making changes to ensure the new theme is loaded.
|
||||
- Check the ComfyUI console for any error messages related to theme loading.
|
||||
- The theme should appear in the Mega Prompt Generator V3 dropdown menu.
|
||||
|
||||
4. **Empty or unexpected results:**
|
||||
- Inspect the `generate()` method in your handler. Are you returning the expected components?
|
||||
- Check the values in your `your_theme.json` file. Are they valid and appropriate for your theme?
|
||||
- Test with different parameter combinations (e.g., `custom_subject`, `custom_location`, toggling environment/style/effects).
|
||||
|
||||
---
|
||||
|
||||
## Additional Tips & Reminders
|
||||
|
||||
- **Restart Required:**
|
||||
After adding or modifying handler/config files, always restart ComfyUI to reload all themes and avoid caching issues.
|
||||
|
||||
- **File Placement:**
|
||||
Place your handler file in `Core_Nodes/theme_handlers/` and your config file in `Core_Nodes/configs/`.
|
||||
|
||||
- **Python Syntax:**
|
||||
Use a code editor with Python syntax checking to avoid indentation or syntax errors in your handler file.
|
||||
|
||||
- **Handler Inheritance:**
|
||||
Your handler class must inherit from `BaseThemeHandler` for compatibility.
|
||||
|
||||
- **Random Choice Methods:**
|
||||
Use `_get_random_choice` for standard random selection, or `_safe_choice` if you want to provide a fallback value.
|
||||
|
||||
- **Docstrings & Comments:**
|
||||
Add docstrings and comments to your handler for clarity and maintainability.
|
||||
|
||||
- **Updating Existing Themes:**
|
||||
To update a theme, edit the handler or config file, then restart ComfyUI. You can add new elements to the config or extend the handler logic as needed.
|
||||
|
||||
---
|
||||
|
||||
@@ -151,6 +309,7 @@ def _init_mappings(self):
|
||||
- **Handler class**: Use `PascalCase` (e.g., `MedievalThemeHandler`).
|
||||
- **Internal name**: Use `snake_case` (e.g., `medieval_theme`).
|
||||
- **Display name**: Include an emoji + title case (e.g., `🎨 Medieval Theme`).
|
||||
- **Config key**: Should match the internal name (e.g., `"medieval_theme": {...}`).
|
||||
|
||||
---
|
||||
|
||||
@@ -164,8 +323,8 @@ def _init_mappings(self):
|
||||
prompt = handler.generate(custom_subject="medieval castle")
|
||||
print(prompt) # Inspect the generated prompt
|
||||
```
|
||||
5. Check the dropdown menu in ComfyUI for your theme name.
|
||||
6. Experiment with different `custom_subject` values to ensure the theme integrates correctly.
|
||||
5. Check the dropdown menu in ComfyUI for your theme name (Mega Prompt Generator V3 node).
|
||||
6. Experiment with different `custom_subject` values and other parameters to ensure the theme integrates correctly.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ ARTISTIC STYLES
|
||||
7. 🎨 Watercolor - Emulates watercolor painting techniques and effects
|
||||
8. 🏺 Clay Art - Mimics clay sculpture and modeling with characteristic texture and dimensionality
|
||||
9. 🖍️ Crayon Art - Simulates crayon drawing style with characteristic textures and strokes
|
||||
10. 💗 Spectral Mist - Produces ethereal, misty, and spectral visual effects
|
||||
|
||||
ANIMATION & CARTOON
|
||||
1. 📺 Animation Cartoon - Creates cartoon-style animations with exaggerated features and dynamic movement
|
||||
@@ -19,6 +20,7 @@ ANIMATION & CARTOON
|
||||
7. 💫 Pixar - Replicates Pixar's 3D animation style with characteristic appeal
|
||||
8. 📚 School Manga - Focuses on school-themed manga style
|
||||
9. 🎭 Stop Motion - Mimics stop-motion animation style with characteristic textures
|
||||
10. 👧 Skinny Blonde Girl - Focuses on the "skinny blonde girl" character archetype in stylized art
|
||||
|
||||
FANTASY & MYTHICAL
|
||||
1. 🦄 Chimera Animals - Generates hybrid creatures combining features from different animal species
|
||||
@@ -27,6 +29,7 @@ FANTASY & MYTHICAL
|
||||
4. ⚔️ Fantasy - Generates high fantasy imagery with magical elements and mythical creatures
|
||||
5. ⚔️ Miura Dark Fantasy - Inspired by Kentaro Miura's dark fantasy style
|
||||
6. 🌊 Underwater Civilization - Creates underwater scenes with civilizations
|
||||
7. 🏛️ Spartan 300 - Inspired by the Spartan warriors of ancient Greece, especially the "300" aesthetic
|
||||
|
||||
FUTURISTIC & SCI-FI
|
||||
1. 🧬 Bio-Organic Technology - Blends biological and technological elements in a futuristic organic style
|
||||
@@ -40,6 +43,7 @@ FUTURISTIC & SCI-FI
|
||||
9. 🚀 Sci-Fi - Creates science fiction imagery with futuristic elements
|
||||
10. 🚀 Star Wars - Captures Star Wars universe aesthetic
|
||||
11. ⚙️ Steampunk - Combines Victorian era with steam-powered technology
|
||||
12. 🚀 Space Colony - Depicts advanced human settlements and life in outer space
|
||||
|
||||
HOLIDAYS & CELEBRATIONS
|
||||
1. 🏮 Chinese New Year - Celebrates Chinese New Year themes with traditional elements and festivities
|
||||
@@ -68,6 +72,7 @@ ARCHITECTURAL & SPACES
|
||||
1. 🏛️ Architectural - Focuses on architectural designs, structures, and building compositions
|
||||
2. 🏠 Interior Spaces - Specializes in interior design and architectural spaces
|
||||
3. 🏠 Village World - Creates village scenes with various cultural elements
|
||||
4. 🏛️ Historical Monuments - Focuses on famous historical monuments and their architectural details
|
||||
|
||||
SPECIALIZED THEMES
|
||||
1. 🖼️ Binet Surreal - Creates surrealistic artwork inspired by Binet's mathematical and dreamlike style
|
||||
@@ -86,4 +91,6 @@ SPECIALIZED THEMES
|
||||
14. 🧩 Puzzle Dimension - Generates puzzle-like compositions with dimensional elements
|
||||
15. 📱 Selfie - Specializes in selfie-style portrait photography
|
||||
16. 🥙 Street Food Kebab - Focuses on street food photography, particularly kebabs
|
||||
17. 👴 Vintage Anthropomorphic - Produces vintage-style anthropomorphic characters
|
||||
17. 👴 Vintage Anthropomorphic - Produces vintage-style anthropomorphic characters
|
||||
18. 📸 Vintage 1800s Photography - Emulates the look and feel of 19th-century photography
|
||||
19. 🏝️ Tropical Paradise - Depicts idyllic tropical settings with lush vegetation, beaches, and vibrant colors
|
||||
@@ -31,7 +31,7 @@ custom_nodes/
|
||||
├── character/
|
||||
│ ├── __init__.py
|
||||
│ └── character_handlers.py
|
||||
└── [other theme categories]/
|
||||
└── [other theme categories]/
|
||||
```
|
||||
|
||||
Core Files:
|
||||
@@ -51,12 +51,14 @@ Theme handlers are organized into appropriate categories within the theme_handle
|
||||
1. A dedicated subdirectory (e.g., `abstract/`, `animation/`, etc.)
|
||||
2. An `__init__.py` file for proper Python package structure
|
||||
3. One or more handler implementation files
|
||||
4. **A corresponding JSON configuration file in the `configs/` directory for all randomizable elements.**
|
||||
|
||||
When adding new theme handlers:
|
||||
1. Place them in the appropriate category directory
|
||||
2. Update the category's `__init__.py` to expose the new handler
|
||||
3. Register the handler in `mega_prompt_all_themes.py`
|
||||
4. Ensure that the handler class inherits from `BaseThemeHandler`.
|
||||
1. Place them in the appropriate category directory (e.g., for Space Colony, use a sci-fi or space subdirectory under `theme_handlers/`)
|
||||
2. Update the category's `__init__.py` to expose the new handler (e.g., add `from .space_colony_handler import SpaceColonyHandler`)
|
||||
3. Register the handler in `mega_prompt_all_themes.py` and `mega_prompt_V3.py` (add to handler mappings and emoji mappings)
|
||||
4. Ensure that the handler class inherits from `BaseThemeHandler` and loads all randomizable elements from its config file (do not hardcode lists in the handler)
|
||||
5. **Create or update a JSON config file in `configs/` (e.g., `Core_Nodes/configs/space_colony_config.json`) to define all lists and options used by the handler. Reference only config data in the handler.**
|
||||
|
||||
This organization helps maintain a clean and scalable codebase while making it easier to locate and manage related themes.
|
||||
|
||||
@@ -236,6 +238,8 @@ Theme configurations are stored in JSON files with the following structure:
|
||||
}
|
||||
```
|
||||
|
||||
**All randomizable elements for a theme must be defined in its JSON config file. The handler should never hardcode lists or options, but always load them from the config.**
|
||||
|
||||
For example, the nature theme configuration includes:
|
||||
```json
|
||||
{
|
||||
@@ -260,6 +264,7 @@ For example, the nature theme configuration includes:
|
||||
- Use JSON Schema for config validation
|
||||
- Implement type checking
|
||||
- Validate required fields
|
||||
- **Ensure all handler random choices are present in the JSON config file.**
|
||||
|
||||
2. **Versioning**:
|
||||
- Include config version number
|
||||
@@ -292,31 +297,30 @@ For example, the nature theme configuration includes:
|
||||
}
|
||||
```
|
||||
|
||||
**When adding or updating a theme, always update the JSON config file to reflect all prompt elements used by the handler.**
|
||||
|
||||
### Instructions for Adding a New Theme to Mega Prompt V3
|
||||
|
||||
To add a new theme to the system, follow these steps:
|
||||
|
||||
1. Choose the appropriate category directory under `theme_handlers/` (e.g., `abstract/`, `animation/`, etc.)
|
||||
2. Create a new handler file in that directory (e.g., `my_new_theme_handler.py`)
|
||||
3. Create a corresponding config file in the `configs` directory (e.g., `configs/my_new_theme_config.json`)
|
||||
3. **Create a corresponding config file in the `configs` directory (e.g., `configs/my_new_theme_config.json`) and define all randomizable elements there.**
|
||||
4. In the theme handler file, create a new class that inherits from `BaseThemeHandler`
|
||||
5. Implement the required methods for your theme handler
|
||||
5. Implement the required methods for your theme handler, always loading lists/options from the config file.
|
||||
6. Update the category's `__init__.py` to expose your new handler
|
||||
7. Register the handler in `mega_prompt_all_themes.py`
|
||||
8. Add any necessary configuration entries to the config file
|
||||
|
||||
Example handler structure:
|
||||
```python
|
||||
from ...base_theme_handler import BaseThemeHandler
|
||||
**Example: Improving the Space Colony Theme**
|
||||
|
||||
class MyNewThemeHandler(BaseThemeHandler):
|
||||
def __init__(self):
|
||||
super().__init__("my_new_theme")
|
||||
|
||||
def generate(self, **kwargs):
|
||||
# Implementation here
|
||||
pass
|
||||
```
|
||||
- Place `space_colony_handler.py` in `theme_handlers/` (or a `sci_fi/` subdirectory if organizing by category)
|
||||
- In `theme_handlers/__init__.py`, add `from .space_colony_handler import SpaceColonyHandler`
|
||||
- In `mega_prompt_V3.py`, add `"space_colony": "SpaceColonyHandler"` to handler mappings and `"🚀 Space Colony": "space_colony"` to emoji mappings
|
||||
- In `Core_Nodes/configs/space_colony_config.json`, define all randomizable elements (main_elements, settings, styles, effects, etc.)
|
||||
- In the handler, always use `self.theme_config.get("main_elements", [])` etc. for all random choices
|
||||
|
||||
**This ensures the Space Colony theme is fully config-driven, maintainable, and consistent with the MegaPromptV3 system architecture.**
|
||||
|
||||
### Instructions for Adding a New Node
|
||||
|
||||
@@ -390,7 +394,8 @@ To add a new node that integrates with the MegaPromptV3 system, follow these ste
|
||||
- Save workflows in the `Workflows` directory
|
||||
- Test compatibility with existing nodes
|
||||
|
||||
Remember to maintain consistency with the existing codebase structure and follow the established patterns for error handling, configuration management, and user interface design.
|
||||
Remember to maintain consistency with the existing codebase structure and follow the established patterns for error handling, configuration management, and user interface design.
|
||||
**Always use the JSON config file for all theme data and randomization.**
|
||||
|
||||
### Error Handling and Logging
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ Isulion ComfyUI Custom Nodes
|
||||
A collection of powerful prompt generation nodes for ComfyUI
|
||||
"""
|
||||
|
||||
__version__ = "5.1.4"
|
||||
__version__ = "5.1.5"
|
||||
__author__ = "Isulion"
|
||||
__description__ = "Advanced prompt generation nodes for ComfyUI with multiple themes and styles"
|
||||
|
||||
@@ -142,4 +142,4 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"⧉ IsulionOverlay": "⧉ IsulionOverlay"
|
||||
}
|
||||
|
||||
__version__ = "5.1.4"
|
||||
__version__ = "5.1.5"
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui_isulion"
|
||||
description = "ComfyUI Nodes that generate prompts and many more"
|
||||
version = "5.1.4"
|
||||
version = "5.1.5"
|
||||
license = "file: LICENSE"
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user