Refactor AIImages mod to replace ArtStyle enum with ArtStyleDef name for improved flexibility in prompt generation. Update UI components to reflect changes in art style selection and enhance scrolling functionality in the right column. Update AIImages.dll to incorporate the latest modifications.
This commit is contained in:
124
Defs/README.md
Normal file
124
Defs/README.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# AI Images - Defs Documentation
|
||||
|
||||
This folder contains XML definition files that allow you to easily customize art styles and image size presets without recompiling the mod.
|
||||
|
||||
## Art Style Definitions (ArtStyleDefs.xml)
|
||||
|
||||
Art styles define how images should be generated, including prompts, quality tags, and negative prompts.
|
||||
|
||||
### Structure
|
||||
|
||||
```xml
|
||||
<AIImages.ArtStyleDef>
|
||||
<defName>ArtStyle_MyStyle</defName>
|
||||
<label>My Custom Style</label>
|
||||
<description>Description of the style</description>
|
||||
<positivePrompt>style keywords here</positivePrompt>
|
||||
<negativePrompt>things to avoid</negativePrompt>
|
||||
<qualityTags>additional quality tags</qualityTags>
|
||||
<addBaseQualityTags>true</addBaseQualityTags>
|
||||
<addBaseNegativePrompts>true</addBaseNegativePrompts>
|
||||
<sortOrder>100</sortOrder>
|
||||
</AIImages.ArtStyleDef>
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
- **defName**: Unique identifier (must start with `ArtStyle_`)
|
||||
- **label**: Display name shown in the UI
|
||||
- **description**: Tooltip text explaining the style
|
||||
- **positivePrompt**: Keywords added to the positive prompt (e.g., "photorealistic, 8k uhd")
|
||||
- **negativePrompt**: Keywords added to the negative prompt (e.g., "cartoon, anime")
|
||||
- **qualityTags**: Style-specific quality tags
|
||||
- **addBaseQualityTags**: If true, adds "highly detailed, professional, masterpiece, best quality"
|
||||
- **addBaseNegativePrompts**: If true, adds base negative prompts like "ugly, deformed, low quality"
|
||||
- **sortOrder**: Determines order in the UI (lower numbers appear first)
|
||||
|
||||
### Example: Custom Watercolor Style
|
||||
|
||||
```xml
|
||||
<AIImages.ArtStyleDef>
|
||||
<defName>ArtStyle_Watercolor</defName>
|
||||
<label>Watercolor</label>
|
||||
<description>Soft watercolor painting style</description>
|
||||
<positivePrompt>watercolor painting, soft colors, flowing paint, artistic</positivePrompt>
|
||||
<negativePrompt>photograph, digital art, sharp edges</negativePrompt>
|
||||
<qualityTags>traditional art, paper texture</qualityTags>
|
||||
<addBaseQualityTags>true</addBaseQualityTags>
|
||||
<addBaseNegativePrompts>true</addBaseNegativePrompts>
|
||||
<sortOrder>65</sortOrder>
|
||||
</AIImages.ArtStyleDef>
|
||||
```
|
||||
|
||||
## Image Size Presets (ImageSizePresetDefs.xml)
|
||||
|
||||
Image size presets provide quick buttons for common image dimensions.
|
||||
|
||||
### Structure
|
||||
|
||||
```xml
|
||||
<AIImages.ImageSizePresetDef>
|
||||
<defName>Size_1024x1024</defName>
|
||||
<label>1024x1024</label>
|
||||
<width>1024</width>
|
||||
<height>1024</height>
|
||||
<category>Square</category>
|
||||
<sortOrder>30</sortOrder>
|
||||
</AIImages.ImageSizePresetDef>
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
- **defName**: Unique identifier (should start with `Size_`)
|
||||
- **label**: Display text on the button
|
||||
- **width**: Image width in pixels
|
||||
- **height**: Image height in pixels
|
||||
- **category**: Grouping category (Square, Portrait, Landscape, or custom)
|
||||
- **sortOrder**: Determines button order (lower numbers appear first)
|
||||
|
||||
### Example: Ultra-wide Size
|
||||
|
||||
```xml
|
||||
<AIImages.ImageSizePresetDef>
|
||||
<defName>Size_2048x1024</defName>
|
||||
<label>2048x1024</label>
|
||||
<width>2048</width>
|
||||
<height>1024</height>
|
||||
<category>Ultrawide</category>
|
||||
<sortOrder>95</sortOrder>
|
||||
</AIImages.ImageSizePresetDef>
|
||||
```
|
||||
|
||||
## Adding Custom Definitions
|
||||
|
||||
1. **Create a new XML file** in the `Defs` folder
|
||||
2. **Start with the XML header**:
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Defs>
|
||||
<!-- Your definitions here -->
|
||||
</Defs>
|
||||
```
|
||||
3. **Add your definitions** using the structures above
|
||||
4. **Restart RimWorld** to load the new definitions
|
||||
|
||||
## Tips
|
||||
|
||||
- Keep `defName` unique to avoid conflicts
|
||||
- Use descriptive `label` values for the UI
|
||||
- Adjust `sortOrder` to organize items logically
|
||||
- Test your prompts with different characters to ensure good results
|
||||
- For art styles, experiment with different combinations of tags
|
||||
- Consider using existing styles as templates
|
||||
|
||||
## Compatibility
|
||||
|
||||
These definitions are compatible with other mods. If another mod adds art styles or size presets, they will all appear together in the UI.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Style doesn't appear**: Check that `defName` is unique and starts with `ArtStyle_`
|
||||
- **Size preset missing**: Verify the XML syntax and that `defName` starts with `Size_`
|
||||
- **Prompts not working**: Make sure prompts are in English and follow Stable Diffusion prompt syntax
|
||||
- **XML errors**: Use an XML validator to check your file for syntax errors
|
||||
|
||||
Reference in New Issue
Block a user