diff --git a/Icons/Metapipe2Icon.png b/Icons/Metapipe2Icon.png new file mode 100644 index 0000000..8545c83 Binary files /dev/null and b/Icons/Metapipe2Icon.png differ diff --git a/Icons/UI LOGO2.png b/Icons/UI LOGO2.png new file mode 100644 index 0000000..5073a33 Binary files /dev/null and b/Icons/UI LOGO2.png differ diff --git a/Icons/UIButton14Pressedi.png b/Icons/UIButton14Pressedi.png new file mode 100644 index 0000000..534ffc1 Binary files /dev/null and b/Icons/UIButton14Pressedi.png differ diff --git a/Icons/UIButton14i.png b/Icons/UIButton14i.png new file mode 100644 index 0000000..1972a23 Binary files /dev/null and b/Icons/UIButton14i.png differ diff --git a/Icons/UIButton15Pressedi.png b/Icons/UIButton15Pressedi.png new file mode 100644 index 0000000..edc51fe Binary files /dev/null and b/Icons/UIButton15Pressedi.png differ diff --git a/Icons/UIButton15Pressedii.png b/Icons/UIButton15Pressedii.png new file mode 100644 index 0000000..fa266cd Binary files /dev/null and b/Icons/UIButton15Pressedii.png differ diff --git a/Icons/UIButton15i.png b/Icons/UIButton15i.png new file mode 100644 index 0000000..ec84a79 Binary files /dev/null and b/Icons/UIButton15i.png differ diff --git a/Icons/UIButton15ii.png b/Icons/UIButton15ii.png new file mode 100644 index 0000000..ae9fbe3 Binary files /dev/null and b/Icons/UIButton15ii.png differ diff --git a/Icons/UIButton16Pressedi.png b/Icons/UIButton16Pressedi.png new file mode 100644 index 0000000..2d428e4 Binary files /dev/null and b/Icons/UIButton16Pressedi.png differ diff --git a/Icons/UIButton16i.png b/Icons/UIButton16i.png new file mode 100644 index 0000000..4d05d80 Binary files /dev/null and b/Icons/UIButton16i.png differ diff --git a/Icons/UIButton6Pressedi.png b/Icons/UIButton6Pressedi.png new file mode 100644 index 0000000..7216cf5 Binary files /dev/null and b/Icons/UIButton6Pressedi.png differ diff --git a/Icons/UIButton6i.png b/Icons/UIButton6i.png new file mode 100644 index 0000000..fd33a97 Binary files /dev/null and b/Icons/UIButton6i.png differ diff --git a/Icons/UIButton8Pressedi.png b/Icons/UIButton8Pressedi.png new file mode 100644 index 0000000..02d4ccb Binary files /dev/null and b/Icons/UIButton8Pressedi.png differ diff --git a/Icons/UIButton8i.png b/Icons/UIButton8i.png new file mode 100644 index 0000000..beba257 Binary files /dev/null and b/Icons/UIButton8i.png differ diff --git a/Icons/UIButton9Pressedi.png b/Icons/UIButton9Pressedi.png new file mode 100644 index 0000000..d189d20 Binary files /dev/null and b/Icons/UIButton9Pressedi.png differ diff --git a/Icons/UIButton9i.png b/Icons/UIButton9i.png new file mode 100644 index 0000000..0f0b688 Binary files /dev/null and b/Icons/UIButton9i.png differ diff --git a/Icons/UICover.png b/Icons/UICover.png index 4d8521c..80cf242 100644 Binary files a/Icons/UICover.png and b/Icons/UICover.png differ diff --git a/MetaPipeFree24.py b/MetaPipeFree3.py similarity index 96% rename from MetaPipeFree24.py rename to MetaPipeFree3.py index fe19513..4e60e1d 100644 --- a/MetaPipeFree24.py +++ b/MetaPipeFree3.py @@ -45,7 +45,7 @@ os.environ['MAYA_PLUG_IN_PATH'] = updated_path if maya_version < 2022 or maya_version > 2024: raise ValueError("Metapipe only works with MAYA 2022/2023/2024") ROOT_DIR = "c:/dna_calibration" -MAIN_PATH = "c:/Arts and Spells/Metapipe Free 2.4.0" +MAIN_PATH = "c:/Arts and Spells/Metapipe Free 3.0.0" iconPath = MAIN_PATH + "/Icons/" MAYA_VERSION = maya_version ROOT_LIB_DIR = f"{ROOT_DIR}/lib/Maya{MAYA_VERSION}" @@ -63,6 +63,7 @@ syspath.insert(0, ROOT_DIR) syspath.insert(0, LIB_DIR) sys.path.append(MAIN_PATH) sys.path.append("c:/Arts and Spells/Scripts") +sys.path.append(ROOT_DIR + "/examples") #Dna Path dnaPath= "C:/Users/MONSTER/Documents/Megascans Library/Downloaded/DHI/h344NMUV_asset/1k/asset_source/MetaHumans/CustomDNA/SourceAssets/CustomDNA.dna" @@ -210,18 +211,17 @@ def openDNAViewer(): leftPanelButtonV(1) -def datasBuild(): +def datasBuild(mod): from dna_viewer import DNA, RigConfig, build_rig - #datas_dna.assemble_maya_scene() - result = cmds.confirmDialog( - title="Build DNA", - message="Please choose Build DNA Option.", - button=["Editable", "Rigged", "Cancel"], - defaultButton="Editable", - cancelButton="Cancel", - dismissString="Cancel") - - if result == "Editable": + file_path = "c:/Arts and Spells/Scripts/dat.py" + if os.path.exists(file_path): + import dat + importlib.reload(dat) + ROOT_DIR = dat.ROOT_DIR + MAIN_PATH = dat.MAIN_PATH + dnaPath = dat.dnaPath + body_type = dat.body_type + if mod == "gen": DATA_DIR = f"{ROOT_DIR}/data" dna = DNA(dnaPath) config = RigConfig( @@ -233,7 +233,7 @@ def datasBuild(): cmds.delete("rl4Embedded_Archetype") if cmds.objExists("rl4Embedded_Archtype"): cmds.delete("rl4Embedded_Archtype") - elif result == "Rigged": + elif mod=="rigged": DATA_DIR = f"{ROOT_DIR}/data" dna = DNA(dnaPath) config = RigConfig( @@ -241,8 +241,46 @@ def datasBuild(): analog_gui_path=f"{DATA_DIR}/analog_gui.ma", aas_path=f"{DATA_DIR}/additional_assemble_script.py") build_rig(dna=dna, config=config) + elif mod=="": + #datas_dna.assemble_maya_scene() + result = cmds.confirmDialog( + title="Build DNA", + message="Please choose Build DNA Option.", + button=["Editable", "Rigged", "Cancel"], + defaultButton="Editable", + cancelButton="Cancel", + dismissString="Cancel") -def buildDNA(): + if result == "Editable": + DATA_DIR = f"{ROOT_DIR}/data" + dna = DNA(dnaPath) + config = RigConfig( + gui_path=f"{DATA_DIR}/gui.ma", + analog_gui_path=f"{DATA_DIR}/analog_gui.ma", + aas_path=f"{DATA_DIR}/additional_assemble_script.py") + build_rig(dna=dna, config=config) + if cmds.objExists("rl4Embedded_Archetype"): + cmds.delete("rl4Embedded_Archetype") + if cmds.objExists("rl4Embedded_Archtype"): + cmds.delete("rl4Embedded_Archtype") + elif result == "Rigged": + DATA_DIR = f"{ROOT_DIR}/data" + dna = DNA(dnaPath) + config = RigConfig( + gui_path=f"{DATA_DIR}/gui.ma", + analog_gui_path=f"{DATA_DIR}/analog_gui.ma", + aas_path=f"{DATA_DIR}/additional_assemble_script.py") + build_rig(dna=dna, config=config) + +def buildDNA(mod): + file_path = "c:/Arts and Spells/Scripts/dat.py" + if os.path.exists(file_path): + import dat + importlib.reload(dat) + ROOT_DIR = dat.ROOT_DIR + MAIN_PATH = dat.MAIN_PATH + dnaPath = dat.dnaPath + body_type = dat.body_type """calib_check = f"{ROOT_DIR}/dna_calibration.mod" if not os.path.isfile(calib_check): cmds.confirmDialog(title="ERROR", message="Please download Epic Games Dna Calibration 1.1.0 Version. Version is not matching or files are not found!") @@ -267,16 +305,33 @@ def buildDNA(): cmds.confirmDialog(title="ERROR", message="DNA not found. Please check your preferences and correct the DNA path.") raise ValueError("DNA not found. Please check your preferences and correct the DNA path.") # Create a progress window - datasBuild() + datasBuild(mod) cmds.createNode("transform", name="OpenedDNAInfoNode") if not cmds.objExists("metapipefreewindow"): cmds.createNode("transform", name="metapipefreewindow") leftPanelButtonV(1) def datasLoad(): + file_path = "c:/Arts and Spells/Scripts/dat.py" + if os.path.exists(file_path): + import dat + importlib.reload(dat) + ROOT_DIR = dat.ROOT_DIR + MAIN_PATH = dat.MAIN_PATH + dnaPath = dat.dnaPath + body_type = dat.body_type import datas_dna + importlib.reload(datas_dna) datas_dna.load_dna_data() def loadDNA(): + file_path = "c:/Arts and Spells/Scripts/dat.py" + if os.path.exists(file_path): + import dat + importlib.reload(dat) + ROOT_DIR = dat.ROOT_DIR + MAIN_PATH = dat.MAIN_PATH + dnaPath = dat.dnaPath + body_type = dat.body_type dna_datas = f"{ROOT_DIR}/examples/datas_dna.py" #if not os.path.isfile(dna_datas): @@ -296,6 +351,9 @@ def loadDNA(): def datasSave(): import datas_dna datas_dna.save_dna_data() +def datasSaveRaw(): + import datas_dna + datas_dna.save_dna_data_raw() def saveDNA(): sys.path.append(f"{ROOT_DIR}/examples") datasSave() @@ -1357,15 +1415,18 @@ def codeblock (dnaPath, ROOT_DIR, CHARACTER_NAME, MAIN_PATH, body_type): lines = lines_all[43:204] lineslists = lines_all[217:220] linesload = lines_all[220:226] - lines2 = lines_all[232:247] + lines2 = lines_all[232:247] + lines3 = lines_all[232:246] defload = ["def load_dna_data():\n"] defsave = ["def save_dna_data():\n"] + defsaveraw = ["def save_dna_data_raw():\n"] lines = [line.replace('f"{ospath.dirname(ospath.abspath(__file__))}/..".replace("\\\\", "/")','"'+ROOT_DIR+'"') for line in lines] lines = [line.replace('f"{DNA_DIR}/{CHARACTER_NAME}.dna"', '"'+dnaPath+'"') for line in lines] lines = [line.replace('"Ada"','"'+CHARACTER_NAME+'"') for line in lines] linesload = [" " + line for line in linesload] lines2 = [" " + line for line in lines2] - code_block = ''.join(lines + lineslists + defload + linesload + defsave + lines2) + lines3 = [" " + line for line in lines3] + code_block = ''.join(lines + lineslists + defload + linesload + defsave + lines2 + defsaveraw + lines3) with open(output_file_path, "w") as output_file: output_file.write(code_block) @@ -1407,6 +1468,7 @@ def savePref(textdnaPath, textROOT_DIR, textMAIN_PATH, textbody_type): print(f"New DNA_DIR: {CHARACTER_DNA}") print(f"New DNA_Name: {CHARACTER_NAME}") + print(f"New Body_Type: {body_type}") codeblock (CHARACTER_DNA, ROOT_DIR, CHARACTER_NAME, MAIN_PATH, body_type) if os.path.exists(file_path): import dat @@ -1416,10 +1478,12 @@ def savePref(textdnaPath, textROOT_DIR, textMAIN_PATH, textbody_type): dnaPath = dat.dnaPath body_type = dat.body_type if chX==1: - cmds.deleteUI("prefWindow", window=True) + if cmds.window("prefWindow", exists=True): + cmds.deleteUI("prefWindow", window=True) mFree_window() else: - cmds.deleteUI("prefWindow", window=True) + if cmds.window("prefWindow", exists=True): + cmds.deleteUI("prefWindow", window=True) def prefUI(dnaPath, ROOT_DIR, MAIN_PATH, body_type): heightSpa=20 @@ -1521,7 +1585,7 @@ def mFree_window(): butW=44 offsetTop=0 - b1=cmds.symbolButton("b1", command=lambda x: buildDNA(),image=iconPath + "UIButton1Pressed.png",enable=False) + b1=cmds.symbolButton("b1", command=lambda x: buildDNA("free"),image=iconPath + "UIButton1Pressed.png",enable=False) b2=cmds.symbolButton("b2",command=lambda x: loadDNA(), image=iconPath + "UIButton2Pressed.png", enable=False) b3=cmds.symbolButton("b3",command=lambda x: saveDNA(), image=iconPath + "UIButton3Pressed.png", enable=False) b4=cmds.symbolButton("b4",command=lambda x: prepare_export(), image=iconPath + "UIButton4Pressed.png", enable=False) diff --git a/freeInstaller.py b/freeInstaller.py index 33292bd..b2cb95e 100644 --- a/freeInstaller.py +++ b/freeInstaller.py @@ -12,7 +12,7 @@ else: source_folder_data = os.path.join(source_folder, "data") source_folder_icons = os.path.join(source_folder, "Icons") source_folder_scripts = os.path.join(source_folder, "scripts") -destination_folder = "C:/Arts and Spells/Metapipe Free 2.4.0" +destination_folder = "C:/Arts and Spells/Metapipe Free 3.0.0" destination_folder_data = destination_folder + "/data" destination_folder_icons = destination_folder + "/Icons" destination_folder_scripts = "C:/Arts and Spells/Scripts" diff --git a/metapipe.py b/metapipe.py new file mode 100644 index 0000000..e488bd3 --- /dev/null +++ b/metapipe.py @@ -0,0 +1,46 @@ +import os +import shutil + +source_folder = os.path.dirname(os.path.abspath(__file__)) +source_folder_data = os.path.join(source_folder, "data") +source_folder_icons = os.path.join(source_folder, "Icons") +source_folder_scripts = os.path.join(source_folder, "scripts") +destination_folder = "C:/Arts and Spells/Metapipe Free 3.0.0" +destination_folder_data = destination_folder + "/data" +destination_folder_icons = destination_folder + "/Icons" +destination_folder_scripts = "C:/Arts and Spells/Scripts" +def move_files(source_folder, destination_folder): + files = os.listdir(source_folder) + os.makedirs(destination_folder, exist_ok=True) + os.makedirs(destination_folder_scripts, exist_ok=True) + + for file_name in files: + source = os.path.join(source_folder, file_name) + destination = os.path.join(destination_folder, file_name) + + if os.path.isfile(source): # Check if the item is a file + try: + shutil.copy(source, destination) + except PermissionError as e: + print(f"Permission error: {e}") + # Handle the permission error as needed + +def run(): + if not source_folder == destination_folder: + try: + os.makedirs(destination_folder, exist_ok=True) + move_files(source_folder, destination_folder) + move_files(source_folder_data, destination_folder_data) + move_files(source_folder_icons, destination_folder_icons) + move_files(source_folder_scripts, destination_folder_scripts) + print("Installation completed successfully.") + except Exception as e: + print(f"An Error occurred: {e}") + else: + print("Installation already completed.") + + shelves_folder = os.path.expanduser("~/Documents/maya/2023/prefs/shelves") + if os.path.exists(shelves_folder): + shutil.copy(os.path.join(source_folder, "shelf_MetapipeFree.mel"), shelves_folder) + else: + print("ERROR: Maya folder is not in Default Place. Please copy and paste 'shelf_Metapipe2' file manually.")