LuisMayo / objection_engine

Library that turns comment chains into ace attorney scenes, used in several bots
MIT License
107 stars 20 forks source link

Allow user to manually assign characters to user IDs #88

Closed Meorge closed 2 years ago

Meorge commented 2 years ago

Implements #48. The optional parameter assigned_characters has been added to the render_comment_list() function. Each key is a character (like Character.PHOENIX) and its value is the user_id that the character will portray.

I've included the script manual_character_example.py that demonstrates this. When the characters dictionary in that script is commented out/not sent to render_comment_list(), this is the resulting video:

https://user-images.githubusercontent.com/9957987/197287044-ee486cc5-e704-4c07-9d6c-1b9829d564b5.mp4

Here's the same dialogue but with the characters passed to render_comment_list() (what you'd get if you ran the script):

https://user-images.githubusercontent.com/9957987/197286610-a4ef1eb9-0ff0-48bf-8d28-1eb38401584a.mp4

The get_characters() function inside of utils.py had to be reworked a bit to allow for this; while the testing I did was successful, it might be good to have someone else confirm that the logic looks good before merging.

Thanks!

Meorge commented 2 years ago

Just pushed changes to fix those issues! The order of the assigned_characters is now reversed so that it takes the user ID as the key and the character as the value. The all_rnd_characters issue was taken care of in the process. Now, the first time around it removes any manually assigned characters from the running for random assignment, but if it runs out, those characters should be added back in.

LuisMayo commented 2 years ago

Nice. It looks good from a visual inspection. I want to do some renders to test it but it should be ready to merge later today.

Thanks a lot.

LuisMayo commented 2 years ago

Good to go. Merged!