Idea: Save and load morph lists

Issue #1491 closed
Rincewind created an issue

Use case:

I have a character with many morphs. Custom morphs and expressions.

It would be pretty handy if I could peristate the value custom morphs and expressions and load them on demand.

I found a solution with scripts which is working for myself. But maybe this would be also a useful feature for other people, if anyone else has the need for saving and loading the state of groups of morphs.

Here is what I did.

I created a script to return all morphs which are not 0.0 to the console:

import bpy
import sys
import os
from bpy.utils import resource_path
from pathlib import Path

USER = Path(resource_path('USER'))
API_PATH = USER / "scripts/addons" / "import_daz"

# USER DATA START

OBJECT = bpy.data.objects["my_figure"]

# USER DATA END

dir = os.path.dirname(API_PATH)
if not dir in sys.path:
    sys.path.append(dir)

from import_daz import api

all_morphs = api.get_morphs(OBJECT, "All")

filtered_morphs = {k: v for k, v in all_morphs.items() if v != 0.0}

print(filtered_morphs)

OBJECT has to be adjusted with to correct name.

I copy the result from the System Console to the clipboard

And than use this script to load the morph set by adjusting OBJECT and pasting the result from the clipboard to MORPHS:

import bpy
import sys
import os
from bpy.utils import resource_path
from pathlib import Path

USER = Path(resource_path('USER'))
API_PATH = USER / "scripts/addons" / "import_daz"

# USER DATA START

OBJECT = bpy.data.objects["my_figure"]
MORPHS = {'facs_ctrl_EyeLookAuto': 1, 'My Morph': 0.4}

# USER DATA END

dir = os.path.dirname(API_PATH)
if not dir in sys.path:
    sys.path.append(dir)

from import_daz import api

for (key, value) in MORPHS.items():
    OBJECT[key] = value
api.update_drivers(OBJECT)

If there is an interested to implement this as a feature in Diffeomorphic, I would suggest to use the asset Browser for storing those morph sets, after the diffeo UI is already pretty complex.
BagaIvy is a great example who “sets” for an addon can be stored in the Blender Asset Browser:

https://blendermarket.com/products/bagaivy

Comments (14)

  1. Alessandro Padovani

    My own opinion.

    This doesn’t seem useful as a general use case. Because non-zero morphs in rest pose are more likely to be a custom figure, so to be imported as baked morphs #1466, that also can import the custom jcms. Then we have daz favorites for “pose morphs” that’s your excellent idea. Then we have favorites for extra morphs sets that’s already implemented and also works with easy import.

    So I don’t see anything that could add useful functionality here. I mean it’s already all implemented. Unless I miss something.

  2. Rincewind reporter

    Yes I think you are overseeing some handy usecases:

    1. Store/reuse expressions you did in Blender with FACS

    2. On a character with multiple stages/morphs (e.g. a transformation scene from Human to Werwolf) you can store and load stages of the transformation

    3. You add some more morphs to finetune the cars like nose or lips variations. With this feature you can switch easily between the character varitions.

  3. Alessandro Padovani
    1. You can save your own poses/expressions as duf in daz studio then load them in blender, same as PA's.
    2. Same as point one but with ERCs.
    3. There’s daz favorites already doing the same thing.

    Unless I miss something.

  4. Rincewind reporter

    I guess we have different workflows.

    Once I have a figure in Blender I prevent touch DAZ studio.

    However, my scripts are working fine for me and I will continue use them because for me they are a big time safer.
    I was just asking myself, if other people has a smilar need as me. In your case it seems to be not the case.

  5. Alessandro Padovani

    Unfortunately the blender asset browser doesn’t support drivers, so in general you have to import poses and animations directly from the daz library. This is also why personally I don’t port the daz libraries to the asset browser. And why you always have to “touch“ daz studio even when working in blender. So I don’t understand how your proposed workflow could possibly work, unless for a small subset of features.

    If you explain it better how to use your script and what’s the advantage over the daz library then yes may be it could be useful to others too, if this is your purpose.

  6. Alessandro Padovani

    Ok I believe to understand what you’re after, that was already discussed.

    Issue #1156 was marked as a duplicate of this issue.

  7. Rincewind reporter

    Hey Alessandro,

    This is not a duplicate of #1156. #1156 is basically the favourite import which is now implemented :)

    This proposal is something complety different ;)

    It’s about saving and loading the values of already imported morphs. Basically it’s a preset feature for morphs.

    The asset browser is only one way to give this feature an UI.

    I’m totally aware of that the Asset Browser is very limited into how data can be loaded. That’s why I proposed to take a look to BagaIvy. In BagaIcy you select just an Asset in the Asset Browser, but BagaIcy has it’s own import button which is doing more than it’s possible with the Asset Browser.

    But the Asset Browser is only one way to implement it. Could be also just a button to load and save a json file, which is propably much easier to implement. The beatuy of the Asset Browser would be that we could give the presets own thumbnails.

  8. Alessandro Padovani

    Glad to know that #1156 is resolved with daz favorites I didn’t get it. Updated now. Then we’ll wait for Thomas for morph values to be saved as presets, my own opinion is it’s easier to use daz poses instead, also because poses and morphs are related.

  9. Thomas Larsson repo owner

    Is this any different from favorite morphs, which are defined completely in Blender?

    https://bitbucket.org/Diffeomorphic/import_daz/wiki/Setup/Morphs/Save Favorite Morphs
    https://bitbucket.org/Diffeomorphic/import_daz/wiki/Setup/Morphs/Load Favorite Morphs

    See also the blog post
    https://diffeomorphic.blogspot.com/2021/05/morph-presets-and-easy-import.html

    These favorite morphs were added long before the recently added DAZ favorites. It is unfortunate that the names are so similar; perhaps one concept should be renamed.

  10. Alessandro Padovani

    Yes it is different. If I understand correctly Rincewind wants to save a collection of morph values into a preset file, that would be the same as a daz pose.

    This proposal is something complety different ;)

    It’s about saving and loading the values of already imported morphs. Basically it’s a preset feature for morphs.

  11. Log in to comment