Morphs creation (Copy/Move/Delete/Rename/Backup morphs tool done) #226
Description
So, I try to help by making tools to create like morphs (or muscle if I can figure how it works).
But I had to answer few questions first :
- What is the scope ?
- When can the user create morphs ?
- Where are tools on the panel, are they available all the time ?
- When can we lunch ?
So what I think about that:
- To be able to create good morphs that can be used everywhere, user must starts with the basic shape of one of the 4 big types available in MB-Lab : male, female, anime male, anime female. So, to start with something, I created a “Base female f_NO01” (file characters_config.json) that has no phenotype, no race, and is the base model that used Manuel.
- I also gave to this model a basic albedo.png that looks like clay. Not very good, but well...
- Then I gave it no morphs, no phenotype, nothing. So it’s the most basic model we can have.
- I also created dedicated directory for this type (\data\presets\none_female_base) with no file.
- For me it’s the model user must use to make his own morphs for all female models (realistic female here)
You can see the content in characters_config here:
"f_no01": {
"description": "Generate a base female character for creating morphs",
"template_model": "MBLab_human_female",
"name": "f_no01",
"label": "Base female (F_NO01) (AGPL3)",
...
"texture_sclera_mask" : "sclera_mask.png",
"morphs_extra_file": "",
"shared_morphs_file": "",
"shared_morphs_extra_file": "",
"bounding_boxes_file": "human_female_bbox.json",
...
"vertexgroup_base_file": "human_female_vgroups_base.json",
"vertexgroup_muscle_file": "human_female_vgroups_muscles.json"
}
Problem is that some morphs could be very specific to a race or a phenotype, and could not work properly in all models for a reason. So I decided that user could use the model he wants, and create his own morphs while other morphs are already used. To assure that, I put the “morphs editor” in the Pre-Finalized State session (gui_status == "ACTIVE_SESSION") and put it between “random generator” and “measures”. So, for the user who chooses “F_NO01” he can create, and for the others he can use other morphs as well.
So, as MB_Lab is not designed to create bodies from scratch, but more to use what it is available, I tried to be as simple as possible, while let the user to have the most useful tool to create new morphs.
So now here are the problems I’m facing :
- Let’s take the model f_ca01 in characters_config.json. Few lines are dedicated to the morphs.
"name": "f_ca01",
"morphs_extra_file": "",
"shared_morphs_file": "human_female_morphs.json",
"shared_morphs_extra_file": "human_female_morphs_extra.json", - shared_morphs_file & shared_morphs_extra_file are basic morphs shared by all phenotype from female Caucasian. (extra_files is for fantasy, basically). Here it’s simple, all females share the same files. But it could be something else.
- f_ca01 allows to use morphs that are dedicated to the type (female Caucasian) and the files need to be in the proper format for its name: “f_ca01_whatever_optionalWhatever.json”
- More important: under those files, a same morph is split in two, for minimum values and maximum. Each morph end with _min or _max, so the engine can construct the final morph, from 0 to 1 (0,5 is the model before morphing).
- morphs_extra_file: I think that the intent was to allow user morphs shared buy a whole type?
- So under the directory \data\morphs you have 2 types of files, the ones who are dedicated to a whole range of human (male, female, anime male, anime female) and the others dedicated to types, and it seems that we can add all files we want if they are properly named.
At first, the tool would have looked like this (on the panel):
- Create base model → copy all vertex from actual model shown, whatever it is.
- Load base model → Load an old model.
- Load work-in-progress → Load a model for a morph in progress.
- Reset models → reload work-in-progress model.
- Morph type → a list where we can choose if the morph will be for one type in particular or for a whole range.
- Body type → Male or female.
- Type name → (for example) an02
- Type name extra → none or a name like the pseudo of the author.
- Morph name → A name for the morph.
- Min or Max → the target morph is for min values or max.
- Save work-in-progress → Save all actual model as a work-in-progress.
- Quick save → No dialog, take the name, add _min or _max, and _000 (or _001, _002, …) and save the morph, aka the vertices that are their location changed.
- Save final morph: Same thing, but we have to choose min and max files, and the file is properly saved in the dedicated directory.
But, first I wanted to have my own models, copies of the ones used by the engine, but after a while I started to think that it was not good. The engine is complex, and I should keep a coherence with it. The model the user is working on is linked to the engine, so let’s keep it that way. And the engine has already many useful tools like reset, loading, saving…
So, if the user wants making morphs from base model, no problem, he can use the “reset character” button. If he wants to create while character already has morphs applied, he can use ‘import/export character”.
So now the tool looks like this :
- Morph type → a list where we can choose if the morph will be for one type in particular or for a whole range.
- Body type → Male or female.
- Type name → (for example) an02
- Type name extra → none or a name like the pseudo of the author.
- Morph name → A name for the morph.
- Min or Max → the target morph is for min values or max.
- Load work-in-progress → Load a model for a morph in progress.
- Save work in progress→ No dialog, take the name, add _min or _max, and _000 (or _001, _002, …) and save the morph, aka the vertices that are their location changed.
- Save final morph: Same thing, but we have to choose min and max files, and the file is properly saved in the dedicated directory.
The workflow would look like this :
- I choose for what type the morph is for. → Type name = as01
- Morphs are already existing for the model, so I write my pseudo for save files → Type name extra = Teto
- Morph is for this model → Morph type = dedicated
- For female → Body type = female
- I’m sculpting for min values → Min or Max = min.
- I do my stuff → Save work-in-progress 4 or 5 times.
- It’s done, same thing for Max values.
- It’s done. Save the morph. The file name is automatic, I just have to choose the proper file for min and max values. The file is saved in the dedicated directory. If the file already exists, the morph is added in the file. If the name of the morph already exists, the new one replaces the old one.
I’m working on it now, and if you agree, I’d like to make a morph.py dedicated for this, so the changes in other .py files would be minimal. I’d like to talk about the work in progress here too.