-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ZadesSC/develop
Develop
- Loading branch information
Showing
7 changed files
with
2,769 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea/ | ||
scripts/incident_generator/output/ | ||
scripts/art_generator/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# This script generates an entire characters/ folder | ||
|
||
from tt3k_dw9_art_tool import ArtTool | ||
import argparse | ||
import yaml | ||
import pprint | ||
from path_type import PathType | ||
from pathlib import Path | ||
|
||
|
||
class ArtSetGenerator: | ||
|
||
CONFIG_DIR = "config" | ||
PORTRAIT_SET_CONFIG = "portrait_set_config.yaml" | ||
|
||
def read_portrait_set_config(self): | ||
portrait_set_config_path = Path(self.CONFIG_DIR).joinpath(self.PORTRAIT_SET_CONFIG) | ||
|
||
with open(portrait_set_config_path, 'r') as portrait_set_config_file: | ||
portrait_set_config_data = yaml.safe_load(portrait_set_config_file) | ||
|
||
return portrait_set_config_data | ||
|
||
|
||
def read_portrait_set(self, portrait_set_file_name): | ||
portrait_set_path = Path(self.CONFIG_DIR).joinpath(portrait_set_file_name) | ||
|
||
with open(portrait_set_path, 'r') as portrait_set_file: | ||
portrait_set_data = yaml.safe_load(portrait_set_file) | ||
|
||
return portrait_set_data | ||
|
||
|
||
def build_portrait_set(self, build_target, target_dir): | ||
config_data = self.read_portrait_set_config() | ||
|
||
# logic | ||
# get load order, pull load order yaml files | ||
# loop through arts in config data | ||
# check if load order name exists, if it does, run the art tool on the ps_data | ||
load_order = config_data.get("art_set_build_priority").get(build_target).get("priority") | ||
|
||
#create art tool object | ||
art_tool = ArtTool() | ||
|
||
#loop through load order and load each portrait set yaml | ||
#for now just only load the first one | ||
ps_data = {} | ||
for load_order_set in load_order: | ||
portrait_set = self.read_portrait_set(config_data.get("art_sets").get(load_order_set).get("file_name")) | ||
ps_data.update({load_order_set: portrait_set}) | ||
|
||
# loop through arts | ||
arts = config_data.get("arts") | ||
for art, data in arts.items(): | ||
# check to see which art set to load based on priority | ||
selected_art_set = "" | ||
for load_order_set in load_order: | ||
if load_order_set in data.get("art_sets"): | ||
selected_art_set = load_order_set | ||
|
||
# skip this art if there are no matching sets from the priority list | ||
if selected_art_set == "": | ||
continue | ||
|
||
# get art and create it | ||
art_data = ps_data.get(selected_art_set) | ||
character_art_data = art_data.get("arts").get(art) | ||
pp = pprint.PrettyPrinter(indent=4) | ||
#pp.pprint(character_art_data) | ||
|
||
#run art tool here | ||
char_source_dir = Path(config_data.get("source_dir")).joinpath(config_data.get("art_sets").get(selected_art_set).get("dir")).joinpath(character_art_data.get("src_dir")) | ||
char_target_dir = Path(target_dir).joinpath(character_art_data.get("char_dir_name")) | ||
char_card = character_art_data.get("char_file_name") | ||
char_element = character_art_data.get("element") | ||
char_gender = character_art_data.get("gender") | ||
char_type = character_art_data.get("type") | ||
if char_type == "generic": | ||
char_is_generic = True | ||
elif char_type == "ca_unique" or char_type == "unique": | ||
char_is_generic = False | ||
else: | ||
raise Exception("Error when processing character {}. {} is not a valid value for character type.".format(char_source_dir, char_type)) | ||
|
||
print(char_source_dir) | ||
print(char_target_dir) | ||
print(char_card) | ||
print(char_element) | ||
print(char_gender) | ||
print(char_is_generic) | ||
art_tool.build_target_folder_structure(char_source_dir, char_target_dir, char_card, char_element, char_gender, char_is_generic) | ||
|
||
def main(): | ||
build_target = args.build_target | ||
target_dir = args.target_dir | ||
|
||
art_set_generator = ArtSetGenerator() | ||
art_set_generator.build_portrait_set(build_target, target_dir) | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Builds entire portrait set for the TT3K_DW9 mod') | ||
parser.add_argument("--build_target", required=True, help="source folder", type=str) | ||
parser.add_argument("--target_dir", required=True, help="target folder", type=str) | ||
args = parser.parse_args() | ||
main() |
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
scripts/art_generator/build_unique_art_from_generic_sets.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env python3 | ||
|
||
######################################################################################################################## | ||
# This script is used to build unique portrait sets from generics provided by CA | ||
######################################################################################################################## | ||
|
||
import png | ||
import sys | ||
import argparse | ||
from path_type import PathType | ||
from PIL import Image | ||
from pathlib import Path | ||
|
||
# Subdirectory names | ||
COMPOSITES_DIR = "composites" | ||
STILLS_DIR = "stills" | ||
BOBBLEHEADS_DIR = "bobbleheads" | ||
HALFBODY_LARGE_DIR = "halfbody_large" | ||
HALFBODY_SMALL_DIR = "halfbody_small" | ||
MINI_DIR = "mini" | ||
UNITCARDS_DIR = "unitcards" | ||
LARGE_PANEL_DIR = "large_panel" | ||
SMALL_PANEL_DIR = "small_panel" | ||
FACES_DIR = "faces" | ||
ANGRY_DIR = "angry" | ||
HAPPY_DIR = "happy" | ||
NORMAL_DIR = "normal" | ||
LARGE_DIR = "large" | ||
|
||
# Sub directory dictionary | ||
SUBDIR_DICTS = [{'dir': BOBBLEHEADS_DIR, 'img_key': BOBBLEHEADS_KEY, 'img_large_key': BOBBLEHEADS_LARGE_KEY}, | ||
{'dir': HALFBODY_LARGE_DIR, 'img_key': HALFBODY_LARGE_KEY, 'img_large_key': HALFBODY_LARGE_LARGE_KEY}, | ||
{'dir': HALFBODY_SMALL_DIR, 'img_key': HALFBODY_SMALL_KEY, 'img_large_key': HALFBODY_SMALL_LARGE_KEY}, | ||
{'dir': MINI_DIR, 'img_key': MINI_LARGE_KEY, 'img_large_key': MINI_LARGE_KEY}, | ||
{'dir': UNITCARDS_DIR, 'img_key': UNITCARD_KEY, 'img_large_key': UNITCARD_LARGE_KEY}] | ||
|
||
|
||
def main(): | ||
pass | ||
|
||
|
||
def build_element_set(element_gender_dir): | ||
composite_dir = element_gender_dir.joinpath(COMPOSITES_DIR) | ||
stills_dir = element_gender_dir.joinpath(STILLS_DIR) | ||
|
||
for subdir_dict in SUBDIR_DICTS: | ||
subdir = stills_dir.joinpath(subdir_dict.get('dir')) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Process generic elemental folder and build custom generic/unique folders') | ||
parser.add_argument("--source_dir", required=True, help="source folder, must be the data/UI/characters/ folder and must have the elemental folders", type=str) | ||
parser.add_argument("--target_dir", required=True, help="will output similar to what is in the data/UI/characters/ folder", type=str) | ||
args = parser.parse_args() | ||
main() |
Oops, something went wrong.