Open unicornlox opened 7 months ago
Actually, how do you get the coordinates in the statement "vertex_group_information["basemesh"]["scalp"] = [226,...]" in mpfb/entities/socketobject/_extra_vertex_groups.py file, this can also work for me.
I haven't been able to find any obvious way to select vertices influenced by a shape key via the UI. It should not be that difficult to write such a utility though. The information about which vertices are influenced by a target (ie a slider under model, not any shape key) is available from the target information.
In general, utility functions for manipulating and reading shape keys are available in https://github.com/makehumancommunity/mpfb2/blob/blender4/src/mpfb/services/targetservice.py
A destructive way to get the coordinates after shape keys is by using the bake_targets method. But you could always make a copy before baking. With a basemesh selected, you can get the coordinate of vertex with index 226 after shape keys by running the following in the scripting tab:
import bpy
from mpfb.services.targetservice import TargetService
selected = bpy.context.active_object
print("Coords of vertex 226 before shape keys: " + str(selected.data.vertices[226].co))
duplicated = selected.copy()
duplicated.data = selected.data.copy()
TargetService.bake_targets(duplicated)
print("Coords of vertex 226 after shape keys: " + str(duplicated.data.vertices[226].co))
bpy.data.objects.remove(duplicated)
Or, in extension, if you want to print all coordinates in the scalp group:
import bpy
from mpfb.services.targetservice import TargetService
from mpfb.entities.socketobject import BASEMESH_EXTRA_GROUPS
selected = bpy.context.active_object
duplicated = selected.copy()
duplicated.data = selected.data.copy()
TargetService.bake_targets(duplicated)
print("Coords in scalp: ")
for index in BASEMESH_EXTRA_GROUPS["scalp"]:
print(" Coords for vertex " + str(index) + " are " + str(duplicated.data.vertices[index].co))
bpy.data.objects.remove(duplicated)
Getting information about a shape key can also be done via TargetService. For example, for the nose-scale-depth-incr shape key:
import bpy
from mpfb.services.targetservice import TargetService
selected = bpy.context.active_object
target_info = TargetService.get_shape_key_as_dict(selected, "nose-scale-depth-incr")
print("The following vertices are influenced by the shape key:")
for vert_info in target_info["vertices"]:
print(vert_info[0])
@joepal1976 thank you very much for your reply.
This is more complicated than initially thought. Postponing until a later release.
We update vertex groups in areas like face, hand, and foot with shapekeys, but do we have the ability to select vertex groups through these shapekeys?