Shapey Key Update.
- Viesmes will now use selected armature. - New dropdown menu in the viseme UI so the user can select which mesh to create visemes on. - New helper function get_armature_meshes - Added a new check before we create the new visemes to see if any exist, if there do we will remove them and create the new ones. - fixed several issues and errors.
This commit is contained in:
+9
-3
@@ -96,6 +96,9 @@ def get_all_meshes(context: Context) -> List[Object]:
|
||||
return [obj for obj in bpy.data.objects if obj.type == 'MESH' and obj.parent == armature]
|
||||
return []
|
||||
|
||||
def get_mesh_items(self, context):
|
||||
return [(obj.name, obj.name, "") for obj in get_all_meshes(context)]
|
||||
|
||||
def open_web_after_delay_multi_threaded(delay: typing.Optional[float] = 1.0, url: typing.Union[str, typing.Any] = ""):
|
||||
thread = threading.Thread(target=open_web_after_delay,args=[delay,url],name="open_browser_thread")
|
||||
thread.start()
|
||||
@@ -128,6 +131,10 @@ def sort_shape_keys(mesh: Object) -> None:
|
||||
print("No shape keys found. Exiting sort function.")
|
||||
return
|
||||
|
||||
# Set the mesh as the active object
|
||||
bpy.context.view_layer.objects.active = mesh
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
order = [
|
||||
'Basis',
|
||||
'vrc.blink_left',
|
||||
@@ -176,13 +183,12 @@ def sort_shape_keys(mesh: Object) -> None:
|
||||
index = shape_keys.find(name)
|
||||
if index != i:
|
||||
print(f"Moving {name} from index {index} to {i}")
|
||||
bpy.context.object.active_shape_key_index = index
|
||||
while bpy.context.object.active_shape_key_index > i:
|
||||
mesh.active_shape_key_index = index
|
||||
while mesh.active_shape_key_index > i:
|
||||
bpy.ops.object.shape_key_move(type='UP')
|
||||
|
||||
print("Shape key sorting completed.")
|
||||
|
||||
|
||||
def get_shapekeys(mesh: Object, prefix: str = '') -> List[tuple]:
|
||||
if not has_shapekeys(mesh):
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user