diff options
| -rw-r--r-- | GUI/GUI/GUI/Frame.cpp | 1 | ||||
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 11 | ||||
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.h | 1 | ||||
| -rw-r--r-- | Scripts/libtastt.py | 48 |
4 files changed, 23 insertions, 38 deletions
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index 5416abe..bcf0a2a 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -1791,6 +1791,7 @@ void Frame::OnGenerateFX(wxCommandEvent& event) std::string out;
if (!PythonWrapper::GenerateAnimator(
*app_c_,
+ std::string(AppConfig::kConfigPath),
unity_animator_generated_dir,
unity_animator_generated_name,
unity_parameters_generated_name,
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index a855b4c..4acb51d 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -492,6 +492,7 @@ std::future<bool> PythonWrapper::StartApp( bool PythonWrapper::GenerateAnimator( const AppConfig& config, + const std::string& config_path, const std::string& unity_animator_generated_dir, const std::string& unity_animator_generated_name, const std::string& unity_parameters_generated_name, @@ -749,10 +750,7 @@ bool PythonWrapper::GenerateAnimator( if (!InvokeWithArgs({ libtastt_path, "gen_anims", "--gen_anim_dir", Quote(tastt_animations_path), "--guid_map", Quote(guid_map_path), - "--chars_per_sync", std::to_string(config.chars_per_sync), - "--bytes_per_char", std::to_string(config.bytes_per_char), - "--rows", std::to_string(config.rows), - "--cols", std::to_string(config.cols)}, + "--config", Quote(config_path) }, "Failed to generate animations", out)) { return false; } @@ -763,10 +761,7 @@ bool PythonWrapper::GenerateAnimator( "--fx_dest", Quote(tastt_fx0_path), "--gen_anim_dir", Quote(tastt_animations_path), "--guid_map", Quote(guid_map_path), - "--chars_per_sync", std::to_string(config.chars_per_sync), - "--bytes_per_char", std::to_string(config.bytes_per_char), - "--rows", std::to_string(config.rows), - "--cols", std::to_string(config.cols) }, + "--config", Quote(config_path) }, "Failed to generate FX layer", out)) { return false; } diff --git a/GUI/GUI/GUI/PythonWrapper.h b/GUI/GUI/GUI/PythonWrapper.h index 477224d..0f370a2 100644 --- a/GUI/GUI/GUI/PythonWrapper.h +++ b/GUI/GUI/GUI/PythonWrapper.h @@ -81,6 +81,7 @@ namespace PythonWrapper bool GenerateAnimator( const AppConfig& config, + const std::string& config_path, const std::string& unity_animator_generated_dir, const std::string& unity_animator_generated_name, const std::string& unity_parameters_generated_name, diff --git a/Scripts/libtastt.py b/Scripts/libtastt.py index c8d3958..4cf9357 100644 --- a/Scripts/libtastt.py +++ b/Scripts/libtastt.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import app_config import argparse import array import generate_utils @@ -1001,21 +1002,22 @@ def parseArgs(): parser = argparse.ArgumentParser() parser.add_argument("cmd", type=str, help="") + parser.add_argument("--config", type=str, help="The app config.") parser.add_argument("--gen_dir", type=str, help="The directory under " + "which all generated assets are placed") parser.add_argument("--gen_anim_dir", type=str, help="The directory under " + "which all generated animations are placed.") parser.add_argument("--guid_map", type=str, help="The path to a file which will store guids") parser.add_argument("--fx_dest", type=str, help="The path at which to save the generated FX controller") - parser.add_argument("--bytes_per_char", type=str, help="The number of bytes to use to represent each character") - parser.add_argument("--chars_per_sync", type=str, help="The number of characters to send on each sync event") - parser.add_argument("--rows", type=int, help="The number of rows on the board") - parser.add_argument("--cols", type=int, help="The number of columns on the board") args = parser.parse_args() if not args.gen_dir: args.gen_dir = "generated/" + if not args.config: + print("--config required") + sys.exit(1) + if not args.gen_anim_dir: args.gen_anim_dir = args.gen_dir + "animations/" @@ -1028,23 +1030,17 @@ def parseArgs(): return args if __name__ == "__main__": - os.chdir(os.path.dirname(os.path.abspath(__file__))) - args = parseArgs() + cfg = app_config.getConfig(args.config) - if args.cmd == "gen_anims": - if not args.bytes_per_char or not args.chars_per_sync: - print("--bytes_per_char and --chars_per_sync required", file=sys.stderr) - sys.exit(1) - - if not args.rows or not args.cols: - print("--rows and --cols required", file=sys.stderr) - sys.exit(1) + print(f"chdir to {os.path.dirname(os.path.abspath(__file__))}") + os.chdir(os.path.dirname(os.path.abspath(__file__))) - generate_utils.config.BYTES_PER_CHAR = int(args.bytes_per_char) - generate_utils.config.CHARS_PER_SYNC = int(args.chars_per_sync) - generate_utils.config.BOARD_ROWS = int(args.rows) - generate_utils.config.BOARD_COLS = int(args.cols) + if args.cmd == "gen_anims": + generate_utils.config.BYTES_PER_CHAR = int(cfg["bytes_per_char"]) + generate_utils.config.CHARS_PER_SYNC = int(cfg["chars_per_sync"]) + generate_utils.config.BOARD_ROWS = int(cfg["rows"]) + generate_utils.config.BOARD_COLS = int(cfg["cols"]) guid_map = {} with open(args.guid_map, 'rb') as f: @@ -1056,18 +1052,10 @@ if __name__ == "__main__": with open(args.guid_map, 'wb') as f: pickle.dump(guid_map, f) elif args.cmd == "gen_fx": - if not args.bytes_per_char or not args.chars_per_sync: - print("--bytes_per_char and --chars_per_sync required", file=sys.stderr) - sys.exit(1) - - if not args.rows or not args.cols: - print("--rows and --cols required", file=sys.stderr) - sys.exit(1) - - generate_utils.config.BYTES_PER_CHAR = int(args.bytes_per_char) - generate_utils.config.CHARS_PER_SYNC = int(args.chars_per_sync) - generate_utils.config.BOARD_ROWS = int(args.rows) - generate_utils.config.BOARD_COLS = int(args.cols) + generate_utils.config.BYTES_PER_CHAR = int(cfg["bytes_per_char"]) + generate_utils.config.CHARS_PER_SYNC = int(cfg["chars_per_sync"]) + generate_utils.config.BOARD_ROWS = int(cfg["rows"]) + generate_utils.config.BOARD_COLS = int(cfg["cols"]) guid_map = {} with open(args.guid_map, 'rb') as f: |
