kerem wrote:When I try to export the avatar in (.glb) format, I cannot access all morph targets.
electricmachine wrote: it's time consuming but i guess it can be done through a python script in blender.
import sys, importlib
def dynamic_import(absolute_package_str, key):
for amod in sys.modules:
if amod.endswith(absolute_package_str):
mpfb_mod = importlib.import_module(amod)
if not hasattr(mpfb_mod, key):
raise AttributeError(f"Module {amod} does not have attribute {key}")
return getattr(mpfb_mod, key)
raise ValueError(f"No module found with name ending in {absolute_package_str}")
import bpy, sys, importlib, json, os
LocationService = dynamic_import("mpfb.services.locationservice", "LocationService") # equivalent of "from mpfb.services.locationservice import LocationService"
_TARGETS_DIR = LocationService.get_mpfb_data("targets")
_TARGETS_JSON = os.path.join(_TARGETS_DIR, "target.json")
with open(_TARGETS_JSON, "r") as json_file:
TARGETS = json.load(json_file)
for section in TARGETS.keys():
for category in TARGETS[section]["categories"]:
print(section + " " + category["name"])
import bpy, sys, importlib, json, os
HumanService = dynamic_import("mpfb.services.humanservice", "HumanService")
TargetService = dynamic_import("mpfb.services.targetservice", "TargetService")
macros = TargetService.get_default_macro_info_dict()
macros["gender"] = 0.0 # female
macros["weight"] = 0.4
macros["muscle"] = 0.7
macros["cupsize"] = 0.65
macros["firmness"] = 0.45
macros["race"]["asian"] = 0.0
macros["race"]["african"] = 0.0
macros["race"]["caucasian"] = 1.0
basemesh = HumanService.create_human(macro_detail_dict=macros)
Users browsing this forum: No registered users and 1 guest