From 24636fb2dbbd28583534c0c8ab12ed50cd09f6b8 Mon Sep 17 00:00:00 2001 From: Hotox Date: Thu, 2 May 2019 22:16:04 +0200 Subject: [PATCH 1/4] Enabled dev, changed clipping planes, disabled backface culling again --- README.md | 6 ++++++ __init__.py | 2 +- extern_tools/mmd_tools_local/operators/view.py | 4 ++-- resources/icons/supporters/Nyako_Sai.png | Bin 0 -> 2583 bytes resources/supporters.json | 3 +++ tools/armature.py | 3 ++- 6 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 resources/icons/supporters/Nyako_Sai.png diff --git a/README.md b/README.md index f1a7ffd2..3beb7e92 100644 --- a/README.md +++ b/README.md @@ -332,6 +332,12 @@ It checks for a new version automatically once every day. ## Changelog +#### 0.13.2 +- **Fix Model**: + - Changed clipping planes to 0.01 and 150 +- **General** + - Disabled backface culling in mmd_tools again + #### 0.13.1 - **Fix Model**: - Added option to not join the meshes diff --git a/__init__.py b/__init__.py index 6812aa27..22839aa3 100644 --- a/__init__.py +++ b/__init__.py @@ -36,7 +36,7 @@ 'tracker_url': 'https://github.com/michaeldegroot/cats-blender-plugin/issues', 'warning': '', } -dev_branch = False +dev_branch = True import os import sys diff --git a/extern_tools/mmd_tools_local/operators/view.py b/extern_tools/mmd_tools_local/operators/view.py index 22025e11..6c362a80 100644 --- a/extern_tools/mmd_tools_local/operators/view.py +++ b/extern_tools/mmd_tools_local/operators/view.py @@ -59,7 +59,7 @@ def execute(self, context): shade, context.scene.game_settings.material_mode = ('TEXTURED', 'GLSL') if shading_mode else ('SOLID', 'MULTITEXTURE') for space in self._get_view3d_spaces(context): space.viewport_shade = shade - space.show_backface_culling = True + space.show_backface_culling = False return {'FINISHED'} else: def execute(self, context): #TODO @@ -72,7 +72,7 @@ def execute(self, context): #TODO shading.light = 'FLAT' if shading_mode == 'SHADELESS' else 'STUDIO' shading.color_type = 'TEXTURE' if shading_mode else 'MATERIAL' shading.show_object_outline = False - shading.show_backface_culling = True + shading.show_backface_culling = False return {'FINISHED'} diff --git a/resources/icons/supporters/Nyako_Sai.png b/resources/icons/supporters/Nyako_Sai.png new file mode 100644 index 0000000000000000000000000000000000000000..97ff0234b721ef655ade92286c801b030fc72664 GIT binary patch literal 2583 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 MFdmNe=%9@M0OM4oYybcN literal 0 HcmV?d00001 diff --git a/resources/supporters.json b/resources/supporters.json index 4649a86b..d572917b 100644 --- a/resources/supporters.json +++ b/resources/supporters.json @@ -375,6 +375,9 @@ "description": "creating a comfy life for people who enjoy social VR", "website": "www.subcomvr.com", "tier": 1 + },{ + "displayname": "Nyako_Sai", + "startdate": "2019-05-02" } ] } diff --git a/tools/armature.py b/tools/armature.py index 92ce828c..5b8a15f8 100644 --- a/tools/armature.py +++ b/tools/armature.py @@ -229,7 +229,8 @@ def execute(self, context): armature = Common.set_default_stage() if bpy.context.space_data: - bpy.context.space_data.clip_start = 0.001 + bpy.context.space_data.clip_start = 0.01 + bpy.context.space_data.clip_end = 150 if version_2_79_or_older(): # Set better bone view From 50041d08e19d83aba1603ffbaa3d8b6bd430200a Mon Sep 17 00:00:00 2001 From: Hotox Date: Thu, 2 May 2019 22:39:21 +0200 Subject: [PATCH 2/4] Added back in eye tracking random vertex movement --- README.md | 4 + tools/eyetracking.py | 224 +++++++++++++++++++++---------------------- 2 files changed, 116 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index 3beb7e92..664df261 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,10 @@ It checks for a new version automatically once every day. #### 0.13.2 - **Fix Model**: - Changed clipping planes to 0.01 and 150 + - This prevents rendering inaccuracies (thanks Rokk!) +- **Eye Tracking**: + - Added random vertex movement back in + - Instead of the exporter, Fix Model deleted empty shapekeys now (whoops) - **General** - Disabled backface culling in mmd_tools again diff --git a/tools/eyetracking.py b/tools/eyetracking.py index f92272ca..d132cb84 100644 --- a/tools/eyetracking.py +++ b/tools/eyetracking.py @@ -227,13 +227,13 @@ def execute(self, context): # Check for correct bone hierarchy is_correct = Armature.check_hierarchy(True, [['Hips', 'Spine', 'Chest', 'Neck', 'Head']]) - # if context.scene.disable_eye_movement: - # # print('Repair with mouth.') - # repair_shapekeys_mouth(mesh_name) - # # repair_shapekeys_mouth(mesh_name, context.scene.wink_left) # TODO - # else: - # # print('Repair normal "' + new_right_eye.name + '".') - # repair_shapekeys(mesh_name, new_right_eye.name) + if context.scene.disable_eye_movement: + # print('Repair with mouth.') + repair_shapekeys_mouth(mesh_name) + # repair_shapekeys_mouth(mesh_name, context.scene.wink_left) # TODO + else: + # print('Repair normal "' + new_right_eye.name + '".') + repair_shapekeys(mesh_name, new_right_eye.name) # deleted = [] # # deleted = checkshapekeys() @@ -364,111 +364,111 @@ def fix_eye_position(context, old_eye, new_eye, head, right_side): new_eye.tail[z_cord] = new_eye.head[z_cord] + 0.1 -# # Repair vrc shape keys -# def repair_shapekeys(mesh_name, vertex_group): -# # This is done to fix a very weird bug where the mouth stays open sometimes -# Common.set_default_stage() -# mesh = Common.get_objects()[mesh_name] -# Common.unselect_all() -# Common.set_active(mesh) -# Common.switch('EDIT') -# Common.switch('OBJECT') -# -# bm = bmesh.new() -# bm.from_mesh(mesh.data) -# bm.verts.ensure_lookup_table() -# -# # Get a vertex from the eye vertex group # TODO https://i.imgur.com/tWi8lk6.png after many times resetting the eyes -# print('DEBUG: Group: ' + vertex_group) -# group = mesh.vertex_groups.get(vertex_group) -# if group is None: -# print('DEBUG: Group: ' + vertex_group + ' not found!') -# repair_shapekeys_mouth(mesh_name) -# return -# print('DEBUG: Group: ' + vertex_group + ' found!') -# -# vcoords = None -# gi = group.index -# for v in mesh.data.vertices: -# for g in v.groups: -# if g.group == gi: -# vcoords = v.co.xyz -# -# if not vcoords: -# return -# -# print('DEBUG: Repairing shapes!') -# # Move that vertex by a tiny amount -# moved = False -# i = 0 -# for key in bm.verts.layers.shape.keys(): -# if not key.startswith('vrc.'): -# continue -# print('DEBUG: Repairing shape: ' + key) -# value = bm.verts.layers.shape.get(key) -# for index, vert in enumerate(bm.verts): -# if vert.co.xyz == vcoords: -# if index < i: -# continue -# shapekey = vert -# shapekey_coords = Common.matmul(mesh.matrix_world, shapekey[value]) -# shapekey_coords[0] -= 0.00007 * randBoolNumber() -# shapekey_coords[1] -= 0.00007 * randBoolNumber() -# shapekey_coords[2] -= 0.00007 * randBoolNumber() -# shapekey[value] = Common.matmul(mesh.matrix_world.inverted(), shapekey_coords) -# print('DEBUG: Repaired shape: ' + key) -# i += 1 -# moved = True -# break -# -# bm.to_mesh(mesh.data) -# -# if not moved: -# print('Error: Shapekey repairing failed for some reason! Using random shapekey method now.') -# repair_shapekeys_mouth(mesh_name) -# -# -# def randBoolNumber(): -# if random() < 0.5: -# return -1 -# return 1 -# -# -# # Repair vrc shape keys with random vertex -# def repair_shapekeys_mouth(mesh_name): # TODO Add vertex repairing! -# # This is done to fix a very weird bug where the mouth stays open sometimes -# Common.set_default_stage() -# mesh = Common.get_objects()[mesh_name] -# Common.unselect_all() -# Common.set_active(mesh) -# Common.switch('EDIT') -# Common.switch('OBJECT') -# -# bm = bmesh.new() -# bm.from_mesh(mesh.data) -# bm.verts.ensure_lookup_table() -# -# # Move that vertex by a tiny amount -# moved = False -# for key in bm.verts.layers.shape.keys(): -# if not key.startswith('vrc'): -# continue -# value = bm.verts.layers.shape.get(key) -# for vert in bm.verts: -# shapekey = vert -# shapekey_coords = Common.matmul(mesh.matrix_world, shapekey[value]) -# shapekey_coords[0] -= 0.00007 -# shapekey_coords[1] -= 0.00007 -# shapekey_coords[2] -= 0.00007 -# shapekey[value] = Common.matmul(mesh.matrix_world.inverted(), shapekey_coords) -# print('TEST') -# moved = True -# break -# -# bm.to_mesh(mesh.data) -# -# if not moved: -# print('Error: Random shapekey repairing failed for some reason! Canceling!') +# Repair vrc shape keys +def repair_shapekeys(mesh_name, vertex_group): + # This is done to fix a very weird bug where the mouth stays open sometimes + Common.set_default_stage() + mesh = Common.get_objects()[mesh_name] + Common.unselect_all() + Common.set_active(mesh) + Common.switch('EDIT') + Common.switch('OBJECT') + + bm = bmesh.new() + bm.from_mesh(mesh.data) + bm.verts.ensure_lookup_table() + + # Get a vertex from the eye vertex group # TODO https://i.imgur.com/tWi8lk6.png after many times resetting the eyes + print('DEBUG: Group: ' + vertex_group) + group = mesh.vertex_groups.get(vertex_group) + if group is None: + print('DEBUG: Group: ' + vertex_group + ' not found!') + repair_shapekeys_mouth(mesh_name) + return + print('DEBUG: Group: ' + vertex_group + ' found!') + + vcoords = None + gi = group.index + for v in mesh.data.vertices: + for g in v.groups: + if g.group == gi: + vcoords = v.co.xyz + + if not vcoords: + return + + print('DEBUG: Repairing shapes!') + # Move that vertex by a tiny amount + moved = False + i = 0 + for key in bm.verts.layers.shape.keys(): + if not key.startswith('vrc.'): + continue + print('DEBUG: Repairing shape: ' + key) + value = bm.verts.layers.shape.get(key) + for index, vert in enumerate(bm.verts): + if vert.co.xyz == vcoords: + if index < i: + continue + shapekey = vert + shapekey_coords = Common.matmul(mesh.matrix_world, shapekey[value]) + shapekey_coords[0] -= 0.00007 * randBoolNumber() + shapekey_coords[1] -= 0.00007 * randBoolNumber() + shapekey_coords[2] -= 0.00007 * randBoolNumber() + shapekey[value] = Common.matmul(mesh.matrix_world.inverted(), shapekey_coords) + print('DEBUG: Repaired shape: ' + key) + i += 1 + moved = True + break + + bm.to_mesh(mesh.data) + + if not moved: + print('Error: Shapekey repairing failed for some reason! Using random shapekey method now.') + repair_shapekeys_mouth(mesh_name) + + +def randBoolNumber(): + if random() < 0.5: + return -1 + return 1 + + +# Repair vrc shape keys with random vertex +def repair_shapekeys_mouth(mesh_name): # TODO Add vertex repairing! + # This is done to fix a very weird bug where the mouth stays open sometimes + Common.set_default_stage() + mesh = Common.get_objects()[mesh_name] + Common.unselect_all() + Common.set_active(mesh) + Common.switch('EDIT') + Common.switch('OBJECT') + + bm = bmesh.new() + bm.from_mesh(mesh.data) + bm.verts.ensure_lookup_table() + + # Move that vertex by a tiny amount + moved = False + for key in bm.verts.layers.shape.keys(): + if not key.startswith('vrc'): + continue + value = bm.verts.layers.shape.get(key) + for vert in bm.verts: + shapekey = vert + shapekey_coords = Common.matmul(mesh.matrix_world, shapekey[value]) + shapekey_coords[0] -= 0.00007 + shapekey_coords[1] -= 0.00007 + shapekey_coords[2] -= 0.00007 + shapekey[value] = Common.matmul(mesh.matrix_world.inverted(), shapekey_coords) + print('TEST') + moved = True + break + + bm.to_mesh(mesh.data) + + if not moved: + print('Error: Random shapekey repairing failed for some reason! Canceling!') eye_left = None From 0ce50a36dcca60f7bef851c164cb9826722a70c3 Mon Sep 17 00:00:00 2001 From: Hotox Date: Thu, 2 May 2019 23:44:23 +0200 Subject: [PATCH 3/4] Added bone orientation fix after import, Fix Model now restores object visibility as well --- README.md | 6 +++++- tools/armature.py | 10 +++++++--- tools/common.py | 8 +++++++- tools/importer.py | 29 +++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 664df261..3946a355 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Cats Blender Plugin (0.13.1) +# Cats Blender Plugin (0.13.2) A tool designed to shorten steps needed to import and optimize models into VRChat. Compatible models are: MMD, XNALara, Mixamo, Source Engine, Unreal Engine, DAZ/Poser, Blender Rigify, Sims 2, Motion Builder, 3DS Max and potentially more @@ -333,9 +333,13 @@ It checks for a new version automatically once every day. ## Changelog #### 0.13.2 +- **Importer**: + - Now selects the imported armature after import + - Added bone orientation fix after import if all bones point in the same direction - **Fix Model**: - Changed clipping planes to 0.01 and 150 - This prevents rendering inaccuracies (thanks Rokk!) + - Fix Model also no longer resets the visibility of objects - **Eye Tracking**: - Added random vertex movement back in - Instead of the exporter, Fix Model deleted empty shapekeys now (whoops) diff --git a/tools/armature.py b/tools/armature.py index 5b8a15f8..9537a8ed 100644 --- a/tools/armature.py +++ b/tools/armature.py @@ -83,6 +83,8 @@ def execute(self, context): # # return {'FINISHED'} + saved_data = Common.SavedData() + is_vrm = False if len(Common.get_meshes_objects()) == 0: for mesh in Common.get_meshes_objects(mode=2): @@ -1182,9 +1184,7 @@ def add_eye_children(eye_bone, parent_name): Common.delete_zero_weight() # Connect all bones with their children if they have exactly one - for bone in armature.data.edit_bones: - if len(bone.children) == 1 and bone.name not in ['LeftEye', 'RightEye', 'Head', 'Hips']: - bone.tail = bone.children[0].head + Common.fix_bone_orientations(armature) # # This is code for testing # print('LOOKING FOR BONES!') @@ -1223,14 +1223,18 @@ def add_eye_children(eye_bone, parent_name): if not hierarchy_check_hips['result']: self.report({'ERROR'}, hierarchy_check_hips['message']) + saved_data.load() return {'FINISHED'} if fixed_uv_coords: + saved_data.load() Common.show_error(6.2, ['The model was successfully fixed, but there were ' + str(fixed_uv_coords) + ' faulty UV coordinates.', 'This could result in broken textures and you might have to fix them manually.', 'This issue is often caused by edits in PMX editor.']) return {'FINISHED'} + saved_data.load() + self.report({'INFO'}, 'Model successfully fixed.') return {'FINISHED'} diff --git a/tools/common.py b/tools/common.py index 812a758b..f345de02 100644 --- a/tools/common.py +++ b/tools/common.py @@ -30,7 +30,6 @@ from math import degrees from mathutils import Vector -from threading import Thread from datetime import datetime from html.parser import HTMLParser from html.entities import name2codepoint @@ -1651,6 +1650,13 @@ def fix_zero_length_bones(armature, full_body_tracking, x_cord, y_cord, z_cord): switch(pre_mode) +def fix_bone_orientations(armature): + # Connect all bones with their children if they have exactly one + for bone in armature.data.edit_bones: + if len(bone.children) == 1 and bone.name not in ['LeftEye', 'RightEye', 'Head', 'Hips']: + bone.tail = bone.children[0].head + + def update_material_list(self=None, context=None): try: if hasattr(bpy.context.scene, 'smc_ob_data') and bpy.context.scene.smc_ob_data: diff --git a/tools/importer.py b/tools/importer.py index 01048999..09ece416 100644 --- a/tools/importer.py +++ b/tools/importer.py @@ -96,6 +96,9 @@ def execute(self, context): if version_2_79_or_older(): context.scene.layers[0] = True + # Save all current objects to check which armatures got added by the importer + pre_import_objects = [obj for obj in bpy.data.objects if obj.type == 'ARMATURE'] + # Import the file using their corresponding importer for f in self.files: file_name = f['name'] @@ -169,8 +172,34 @@ def execute(self, context): except AttributeError: bpy.ops.cats_importer.install_vrm('INVOKE_DEFAULT') + # Create list of armatures that got added during import + arm_added_during_import = [obj for obj in bpy.data.objects if obj.type == 'ARMATURE' and obj not in pre_import_objects] + for armature in arm_added_during_import: + print('Added: ', armature.name) + # Select the new armature in cats + bpy.context.scene.armature = armature.name + self.fix_bone_orientations(armature) + return {'FINISHED'} + def fix_bone_orientations(self, armature): + Common.set_active(armature) + Common.switch('EDIT') + for bone in armature.data.edit_bones: + equal_axis_count = 0 + if bone.head[0] == bone.tail[0]: + equal_axis_count += 1 + if bone.head[1] == bone.tail[1]: + equal_axis_count += 1 + if bone.head[2] == bone.tail[2]: + equal_axis_count += 1 + + # If the bone points to more than one direction, don't fix the armatures bones + if equal_axis_count < 2: + return + + Common.fix_bone_orientations(armature) + @register_wrap class ModelsPopup(bpy.types.Operator): From a1e84e6474156d300936c75588ed063a86657a05 Mon Sep 17 00:00:00 2001 From: Hotox Date: Fri, 3 May 2019 01:20:26 +0200 Subject: [PATCH 4/4] 0.13.2 ready, added option to not connect the bones during Fix Model --- README.md | 3 ++- __init__.py | 4 ++-- extentions.py | 7 +++++++ tools/armature.py | 5 ++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3946a355..88a81884 100644 --- a/README.md +++ b/README.md @@ -334,12 +334,13 @@ It checks for a new version automatically once every day. #### 0.13.2 - **Importer**: - - Now selects the imported armature after import + - Now selects the imported armature in Cats - Added bone orientation fix after import if all bones point in the same direction - **Fix Model**: - Changed clipping planes to 0.01 and 150 - This prevents rendering inaccuracies (thanks Rokk!) - Fix Model also no longer resets the visibility of objects + - Added option to not connect the bones to their respective child - **Eye Tracking**: - Added random vertex movement back in - Instead of the exporter, Fix Model deleted empty shapekeys now (whoops) diff --git a/__init__.py b/__init__.py index 22839aa3..76901172 100644 --- a/__init__.py +++ b/__init__.py @@ -30,13 +30,13 @@ 'author': 'GiveMeAllYourCats', 'location': 'View 3D > Tool Shelf > CATS', 'description': 'A tool designed to shorten steps needed to import and optimize models into VRChat', - 'version': (0, 13, 1), # Has to be (x, x, x) not [x, x, x]!! # Only change this version and the dev branch var right before publishing the new update! + 'version': (0, 13, 2), # Has to be (x, x, x) not [x, x, x]!! # Only change this version and the dev branch var right before publishing the new update! 'blender': (2, 80, 0), 'wiki_url': 'https://github.com/michaeldegroot/cats-blender-plugin', 'tracker_url': 'https://github.com/michaeldegroot/cats-blender-plugin/issues', 'warning': '', } -dev_branch = True +dev_branch = False import os import sys diff --git a/extentions.py b/extentions.py index 51f7d1d7..6bb427e2 100644 --- a/extentions.py +++ b/extentions.py @@ -62,6 +62,13 @@ def register(): default=True ) + Scene.connect_bones = BoolProperty( + name='Connect Bones', + description="This connects all bones to their child bone if they have exactly one child bone.\n" + "This will not change how the bones function in any way, it just improves the aesthetic of the armature", + default=True + ) + Scene.use_google_only = BoolProperty( name='Use Old Translations (not recommended)', description="Ignores the internal dictionary and only uses the Google Translator for shape key translations." diff --git a/tools/armature.py b/tools/armature.py index 9537a8ed..f21a7136 100644 --- a/tools/armature.py +++ b/tools/armature.py @@ -1184,7 +1184,8 @@ def add_eye_children(eye_bone, parent_name): Common.delete_zero_weight() # Connect all bones with their children if they have exactly one - Common.fix_bone_orientations(armature) + if context.scene.connect_bones: + Common.fix_bone_orientations(armature) # # This is code for testing # print('LOOKING FOR BONES!') @@ -1317,6 +1318,8 @@ def draw(self, context): row = col.row(align=True) row.prop(context.scene, 'join_meshes') row = col.row(align=True) + row.prop(context.scene, 'connect_bones') + row = col.row(align=True) row.prop(context.scene, 'combine_mats') row = col.row(align=True) row.prop(context.scene, 'remove_zero_weight')