EpicGames / MetaHuman-DNA-Calibration

https://epicgames.github.io/MetaHuman-DNA-Calibration/
Other
436 stars 116 forks source link

example dna_viewer_grab_changes_from_scene_and_propagate_to_dna not working #32

Closed booomji closed 1 year ago

booomji commented 1 year ago

Hello, I'm using the script example dna_viewer_grab_changes_from_scene_and_propagate_to_dna I use option 2.1 - start DNA Viewer GUI (dna_viewer_run_in_maya.py)

Then I run the script upto the load Data part - 3 However this also loads the faceboard gui thereby disabling the ability to adjust the bones !

What am i doing wrong ?

Thanks, b

marijavik commented 1 year ago

Hello @booomji,

When you select the meshes you want to see in the scene, in Build options select only joints and run Process. I would not add a skin cluster as it would deform mesh when you move joints, but if that is what you want - go ahead. The only thing you should not include is rig logic as that would ‘lock’ things.

booomji commented 1 year ago

Hello marijavik, Thank you for replying.

Here ae my steps :
My intention is to tweak a joint then save it back to the dna file.

The script im using to do that is

"dna_viewer_grab_changes_from_scene_and_propagate_to_dna "

These are the steps im following from the script .

1.load the example ada dna file via the dna viewer (check joints in the build options and leave everything else at default. no gui loaded) 2.This brings all of the ada sample mh head lods on top of each other

  1. Then I run the rest of the script for step 3 ( -Run the entire code from the top upto the part called "load data") This is the problematic part. Running step 3 sets the metahuman up "with" the face board rig which disables bone editing. I can't get to the 4th step !

What am I doing wrong ?

EDIT 01 - after making this post I intentionally didn't run the code from lines 205 - 210

DO NOT RUN THIS BOCK START

config = RigConfig( gui_path=f"{DATA_DIR}/gui.ma", analog_gui_path=f"{DATA_DIR}/analog_gui.ma", aas_path=ADDITIONAL_ASSEMBLE_SCRIPT, ) build_rig(dna=dna, config=config)

DO NOT RUN THIS BOCK END

now my tweak is saved with the dna file. The block above is bringing in the gui which locks editing of bones.

Thank you for any help. b

marijavik commented 1 year ago

That is correct - that block of code is working in the same way DNAViewer GUI does when you select everything. Usually I would use something else for getting rig elements into scene:

def show_meshes(dna_path, add_skinning=False, add_blend_shapes=False):
    cmds.file(force=True, new=True)

    dna = DNA(dna_path)

    # Builds and returns the created mesh paths in the scene
    config = Config(
        add_joints=True,
        add_blend_shapes=add_blend_shapes,
        add_skin_cluster=add_skinning,
        add_ctrl_attributes_on_root_joint=True,
        add_animated_map_attributes_on_root_joint=True,
        add_mesh_name_to_blend_shape_channel_name=True,
        add_key_frames=True
    )

    # Build meshes
    build_meshes(dna, config)

And call this function whenever I need to inspect what is in DNA file.

show_meshes(character_dna)
reader = read_dna(character_dna)
calibrated = DNACalibDNAReader(reader)
booomji commented 1 year ago

That is correct - that block of code is working in the same way DNAViewer GUI does when you select everything. Usually I would use something else for getting rig elements into scene:

def show_meshes(dna_path, add_skinning=False, add_blend_shapes=False):
    cmds.file(force=True, new=True)

    dna = DNA(dna_path)

    # Builds and returns the created mesh paths in the scene
    config = Config(
        add_joints=True,
        add_blend_shapes=add_blend_shapes,
        add_skin_cluster=add_skinning,
        add_ctrl_attributes_on_root_joint=True,
        add_animated_map_attributes_on_root_joint=True,
        add_mesh_name_to_blend_shape_channel_name=True,
        add_key_frames=True
    )

    # Build meshes
    build_meshes(dna, config)

And call this function whenever I need to inspect what is in DNA file.

show_meshes(character_dna)
reader = read_dna(character_dna)
calibrated = DNACalibDNAReader(reader)

Thank you for sharing marijavik. Do you feel we should change the comment section to make people aware of this ? Because if you follow the instruction "3. Run this script to the part called "load data" then it is bound to not work leading to frustration for someone else.

If we want to keep the comment the same then perhaps we should comment that part of the code out ? How would this go ? should I make a pull request of will someone from Epic fix this . Thank you so much. b

marijavik commented 1 year ago

No worries, I'll update comments. Thanks for pointing this out.

booomji commented 1 year ago

No worries, I'll update comments. Thanks for pointing this out.

Thanks Marijavik. Once I learn which script to use to add my own custom head blendshape (same topology) , I will make a tutorial .

Cheers, b

booomji commented 1 year ago

I have documented the process of adding a blend shape and swapping out the original head with a custom one using the same script. It worked for me. I hope this works for you too.

documented example file for blendshape