Skip to content

Commit

Permalink
new translate method prep,import custom bonemorphs
Browse files Browse the repository at this point in the history
  • Loading branch information
wikid24 committed Apr 30, 2024
1 parent 4a41c90 commit 8b000b1
Show file tree
Hide file tree
Showing 13 changed files with 1,001 additions and 418 deletions.
2 changes: 2 additions & 0 deletions ffxiv_mmd_tools_helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def register_wrap(cls):
importlib.reload(shaders_colorsetter)
importlib.reload(shaders_mektools)
importlib.reload(shaders)
importlib.reload(translate)
importlib.reload(tex_converter)
importlib.reload(panels)
importlib.reload(panels_retargeting_addon)
Expand Down Expand Up @@ -107,6 +108,7 @@ def register_wrap(cls):
from . import shaders_colorsetter
from . import shaders_mektools
from . import shaders
from . import translate
from . import tex_converter
from . import panels
from . import panels_retargeting_addon
Expand Down
8 changes: 4 additions & 4 deletions ffxiv_mmd_tools_helper/bone_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,11 @@ def add_shoulder_control_bones():
shoulder_R = armature.data.edit_bones["shoulder_R"]
arm_L = armature.data.edit_bones["arm_L"]
arm_R = armature.data.edit_bones["arm_R"]
j_sebo_c = armature.data.edit_bones["j_sebo_c"]
upper_body_3 = armature.data.edit_bones["upper body 3"]

#create new bones
shoulder_P_L = bone_tools.add_bone(armature, 'shoulder_P_L',parent_bone=j_sebo_c,length=shoulder_L.length,head=shoulder_L.head ,tail=shoulder_L.head)
shoulder_P_R = bone_tools.add_bone(armature, 'shoulder_P_R',parent_bone=j_sebo_c,length=shoulder_R.length,head=shoulder_R.head ,tail=shoulder_R.head)
shoulder_P_L = bone_tools.add_bone(armature, 'shoulder_P_L',parent_bone=upper_body_3,length=shoulder_L.length,head=shoulder_L.head ,tail=shoulder_L.head)
shoulder_P_R = bone_tools.add_bone(armature, 'shoulder_P_R',parent_bone=upper_body_3,length=shoulder_R.length,head=shoulder_R.head ,tail=shoulder_R.head)
shoulder_C_L = bone_tools.add_bone(armature, 'shoulder_C_L',parent_bone=shoulder_L,length=shoulder_L.length,head=shoulder_L.tail ,tail=shoulder_L.tail)
shoulder_C_R = bone_tools.add_bone(armature, 'shoulder_C_R',parent_bone=shoulder_R,length=shoulder_R.length,head=shoulder_R.tail ,tail=shoulder_R.tail)

Expand Down Expand Up @@ -862,7 +862,7 @@ def convert_ffxiv_boobs_to_genshin_boobs(context,armature):
boob_core.length = 0
boob_core.length = j_mune_l.length
#upper_body_2_name = bone_tools.get_armature_bone_name_by_mmd_english_bone_name(armature,'upper body 3')
j_sebo_c = armature.data.edit_bones.get('j_sebo_c')
j_sebo_c = armature.data.edit_bones.get(bone_tools.get_armature_bone_name_by_mmd_english_bone_name(armature,'upper body 3'))
boob_core.parent = j_sebo_c

bone_list = [j_mune_l,j_mune_r]
Expand Down
70 changes: 49 additions & 21 deletions ffxiv_mmd_tools_helper/bone_morphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@ def parse_bone_morphs_data_from_csv (csv_data):

return bone_morphs_dictionary

def read_bone_morphs_dict_file(ffxiv_race):

BONE_MORPHS_DICTIONARY = None
BONE_MORPHS_DICTIONARY = import_csv.use_csv_bone_morphs_dictionary(ffxiv_race)

return BONE_MORPHS_DICTIONARY

def read_bone_morphs_list_file():

BONE_MORPHS_LIST = None
Expand All @@ -239,22 +232,19 @@ def change_face_rotation_mode(rotation_mode):
bone.rotation_mode = rotation_mode


def main(context):
def main(context,file_path):

print("the filepath for the selected file is:",file_path)

armature = bpy.context.active_object #model.find_MMD_Armature(bpy.context.object)
bpy.context.view_layer.objects.active = armature

clear_bone_morph()


#print(bone_morph)

if bpy.context.scene.bone_morph_ffxiv_model_list == 'none':
pass
else:
BONE_MORPH_DICTIONARY = read_bone_morphs_dict_file(bpy.context.scene.bone_morph_ffxiv_model_list)
bone_morphs = parse_bone_morphs_data_from_csv(BONE_MORPH_DICTIONARY)
for bone_morph in bone_morphs:
generate_bone_morph(armature,bone_morph,bone_morphs[bone_morph])
BONE_MORPH_DICTIONARY = import_csv.use_csv_bone_morphs_dictionary(file_path)
bone_morphs = parse_bone_morphs_data_from_csv(BONE_MORPH_DICTIONARY)
for bone_morph in bone_morphs:
generate_bone_morph(armature,bone_morph,bone_morphs[bone_morph])



Expand All @@ -276,8 +266,6 @@ class AddBoneMorphs(bpy.types.Operator):
, ("roegadyn", "Roegadyn","Import Roegadyn Bone Morphs") \
, ("viera", "Viera","Import Viera Bone Morphs") \
], name = "Race", default = 'hyur')



bpy.types.Scene.alternate_folder_cbx = bpy.props.BoolProperty(name="Use Alternate Folder for CSVs", default=False)

Expand All @@ -288,9 +276,45 @@ def poll(cls, context):
return obj is not None and obj.type == 'ARMATURE' and root is not None

def execute(self, context):
main(context)

if bpy.context.scene.bone_morph_ffxiv_model_list == 'none':
pass
else:
ffxiv_race = bpy.context.scene.bone_morph_ffxiv_model_list
file_path = (__file__ + r"data\bone_morphs_" + ffxiv_race +".csv").replace("bone_morphs.py" , "")


main(context,file_path)
#context.scene.bone_morph_ffxiv_model_list = self.bone_morph_ffxiv_model_list
return {'FINISHED'}


from bpy_extras.io_utils import ImportHelper
@register_wrap
class ImportCustomBoneMorphsFile(bpy.types.Operator, ImportHelper):
"""Import a custom Bone Morphs CSV File"""
bl_idname = "ffxiv_mmd.import_custom_bone_morphs_file"
bl_label = "Import CSV"
bl_options = {'REGISTER', 'UNDO'}

filename_ext = ".csv"
filter_glob: bpy.props.StringProperty(
default="*.csv",
options={'HIDDEN'},
)

@classmethod
def poll(cls, context):
obj = context.active_object
root = mmd_model.Model.findRoot(obj)
return obj is not None and obj.type == 'ARMATURE' and root is not None

def execute(self, context):
filepath = self.filepath

main (context,filepath)

return {'FINISHED'}

@register_wrap
class OpenBoneMorphsFile(bpy.types.Operator):
Expand All @@ -301,7 +325,11 @@ class OpenBoneMorphsFile(bpy.types.Operator):
def execute(self, context):
import_csv.open_bone_morphs_dictionary(context.scene.bone_morph_ffxiv_model_list)
return {'FINISHED'}





@register_wrap
class ChangeFaceBoneRotationMode(bpy.types.Operator):
"""Changes all Face Bones to the selected Rotation Mode"""
Expand Down
Loading

0 comments on commit 8b000b1

Please sign in to comment.