pinosante / VAM-Evolutionary-Character-Creation

Create beatiful girls, guys and futas using a sophisticated genetic algorithm.
BSD 3-Clause "New" or "Revised" License
16 stars 3 forks source link

Global clean up and bug fixes #40

Closed chris-b-pacon closed 1 year ago

chris-b-pacon commented 1 year ago

Merged all bug fixes into this and performed a lot of low level cleanup.

Please check out and merge into main. Thanks!

Ah, also implemented some unit tests.

pinosante commented 1 year ago
  1. Selecting VAM.exe Folder
  2. Selecting VAM Appearance Folder Gives error:
    load_appearance: loading file C:\Games\VaM 1.19 Clean\Custom\Atom\Person\Appearance\Preset_1.vap
    Loading file C:\Games\VaM 1.19 Clean\Custom\Atom\Person\Appearance\Preset_1.vap into database.
    Exception in Tkinter callback
    Traceback (most recent call last):
    File "C:\Users\ThisPC\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1884, in __call__
    return self.func(*args)
    File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_gui.py", line 143, in <lambda>
    command=lambda: self.select_appearancedir())
    File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_gui.py", line 711, in select_appearancedir
    self.generator.fill_data_with_all_appearances()
    File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_logic.py", line 108, in fill_data_with_all_appearances
    self.gender[f] = get_appearance_gender(self.appearances[f])
    File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_logic.py", line 289, in get_appearance_gender
    morph_names = [morph.name for morph in morph_list]
    File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_logic.py", line 289, in <listcomp>
    morph_names = [morph.name for morph in morph_list]
    AttributeError: 'dict' object has no attribute 'name'
pinosante commented 1 year ago

Maybe you also want to add a dunder equality check for the morph Class? So you assert morph_m == morph_n if they both have the same name, uid and value? Probably would never use it, but couldn't hurt to add.

Right now this fails:

    def test_morph_equality(self):
        m = ecc_logic.Morph('a' , 'b', 0.5)
        n = ecc_logic.Morph('a' , 'b', 0.5)
        self.assertTrue(m == n)
chris-b-pacon commented 1 year ago

Hello,

this happens very likely because you checked out the branch "37-create-classes-from-data-structures", which is a work in progress, and not "ref/cleanup" -- that is the branch I want you to merge into main because this is complete and ready for review.

"37-create-classes-from-data-structures" is in the middle of transition to useage of classes, so it won't work. The code line with the error refers to class Morph, and that was introduced after "ref/cleanup".

Sorry for the confusion -- I thought I did explain in the commit comments that this is not working yet. Of course, feel free to read the code, but don't expect these commit to work.

So, ref/cleanup is ready for merge after your review, that's the reason for creating the pull request #40 and asking you to review it.

  1. Selecting VAM.exe Folder
  2. Selecting VAM Appearance Folder Gives error:
load_appearance: loading file C:\Games\VaM 1.19 Clean\Custom\Atom\Person\Appearance\Preset_1.vap
Loading file C:\Games\VaM 1.19 Clean\Custom\Atom\Person\Appearance\Preset_1.vap into database.
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\ThisPC\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1884, in __call__
    return self.func(*args)
  File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_gui.py", line 143, in <lambda>
    command=lambda: self.select_appearancedir())
  File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_gui.py", line 711, in select_appearancedir
    self.generator.fill_data_with_all_appearances()
  File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_logic.py", line 108, in fill_data_with_all_appearances
    self.gender[f] = get_appearance_gender(self.appearances[f])
  File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_logic.py", line 289, in get_appearance_gender
    morph_names = [morph.name for morph in morph_list]
  File "C:\Users\ThisPC\Documents\Python Scripts\VAM ECC Modules\ecc_logic.py", line 289, in <listcomp>
    morph_names = [morph.name for morph in morph_list]
AttributeError: 'dict' object has no attribute 'name'
chris-b-pacon commented 1 year ago

Maybe you also want to add a dunder equality check for the morph Class? So you assert morph_m == morph_n if they both have the same name, uid and value? Probably would never use it, but couldn't hurt to add.

Right now this fails:

    def test_morph_equality(self):
        m = ecc_logic.Morph('a' , 'b', 0.5)
        n = ecc_logic.Morph('a' , 'b', 0.5)
        self.assertTrue(m == n)

Yes, good idea, as soon as classes are working this will be implemented, but branch "37-create-classes-from-data-structures" is not ready yet for this. Maybe I will stop development on this branch for some days, because I would like to ask my colleagues for an easier way to serialize and deserialize the actual classes instead of nested dictionaries (that is what you get from json.load(), and json.save() expects that you feed it with dicts). Until I see a good solution I may work on the blacklist or something else., working iside a branch based on "ref/cleanup".

PS: Just asked ChatGPT to explain the text above to a child. It answered:

"Okay, let's imagine you have some building blocks and you want to make a tower with them. But, before you start building the tower, you need to organize the building blocks so that it's easier for you to use them. That's what this person is doing with their computer work. They are making sure that everything is organized and in the right place so that they can build their tower (make their computer program). But, they need to ask their friends for help because they don't know the best way to organize the blocks yet. So, they are going to take a break from building the tower for a little while and work on something else until they figure out the best way to organize the blocks."

:D

chris-b-pacon commented 1 year ago

BTW, the project that I am currently working in in the company at the moment has about 7 contributors, 2000 commits, 200 open issues, around 15 parallel features branches in work, around 10 parallel pull requests -- for most of the pull requests I am the person asked for review. Sometimes it is diffcult not to get confused, although this project isn't that large at all.

And please ask if you have questions about the terminology.

pinosante commented 1 year ago

BTW, the project that I am currently working in in the company at the moment has about 7 contributors, 2000 commits, 200 open issues, around 15 parallel features branches in work, around 10 parallel pull requests -- for most of the pull requests I am the person asked for review. Sometimes it is diffcult not to get confused, although this project isn't that large at all.

And please ask if you have questions about the terminology.

That's a lot! Wow.