This commit is contained in:
Jeffreytsai1004 2025-01-15 05:38:09 +08:00
parent 682f41beaa
commit e4a576b81d
20 changed files with 131 additions and 21 deletions

BIN
Icons/Metapipe2Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
Icons/UI LOGO2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
Icons/UIButton14i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Icons/UIButton15i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
Icons/UIButton15ii.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Icons/UIButton16i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
Icons/UIButton6Pressedi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Icons/UIButton6i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
Icons/UIButton8Pressedi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Icons/UIButton8i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
Icons/UIButton9Pressedi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Icons/UIButton9i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 604 KiB

View File

@ -45,7 +45,7 @@ os.environ['MAYA_PLUG_IN_PATH'] = updated_path
if maya_version < 2022 or maya_version > 2024: if maya_version < 2022 or maya_version > 2024:
raise ValueError("Metapipe only works with MAYA 2022/2023/2024") raise ValueError("Metapipe only works with MAYA 2022/2023/2024")
ROOT_DIR = "c:/dna_calibration" 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/" iconPath = MAIN_PATH + "/Icons/"
MAYA_VERSION = maya_version MAYA_VERSION = maya_version
ROOT_LIB_DIR = f"{ROOT_DIR}/lib/Maya{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) syspath.insert(0, LIB_DIR)
sys.path.append(MAIN_PATH) sys.path.append(MAIN_PATH)
sys.path.append("c:/Arts and Spells/Scripts") sys.path.append("c:/Arts and Spells/Scripts")
sys.path.append(ROOT_DIR + "/examples")
#Dna Path #Dna Path
dnaPath= "C:/Users/MONSTER/Documents/Megascans Library/Downloaded/DHI/h344NMUV_asset/1k/asset_source/MetaHumans/CustomDNA/SourceAssets/CustomDNA.dna" 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) leftPanelButtonV(1)
def datasBuild(): def datasBuild(mod):
from dna_viewer import DNA, RigConfig, build_rig from dna_viewer import DNA, RigConfig, build_rig
#datas_dna.assemble_maya_scene() file_path = "c:/Arts and Spells/Scripts/dat.py"
result = cmds.confirmDialog( if os.path.exists(file_path):
title="Build DNA", import dat
message="Please choose Build DNA Option.", importlib.reload(dat)
button=["Editable", "Rigged", "Cancel"], ROOT_DIR = dat.ROOT_DIR
defaultButton="Editable", MAIN_PATH = dat.MAIN_PATH
cancelButton="Cancel", dnaPath = dat.dnaPath
dismissString="Cancel") body_type = dat.body_type
if mod == "gen":
if result == "Editable":
DATA_DIR = f"{ROOT_DIR}/data" DATA_DIR = f"{ROOT_DIR}/data"
dna = DNA(dnaPath) dna = DNA(dnaPath)
config = RigConfig( config = RigConfig(
@ -233,7 +233,7 @@ def datasBuild():
cmds.delete("rl4Embedded_Archetype") cmds.delete("rl4Embedded_Archetype")
if cmds.objExists("rl4Embedded_Archtype"): if cmds.objExists("rl4Embedded_Archtype"):
cmds.delete("rl4Embedded_Archtype") cmds.delete("rl4Embedded_Archtype")
elif result == "Rigged": elif mod=="rigged":
DATA_DIR = f"{ROOT_DIR}/data" DATA_DIR = f"{ROOT_DIR}/data"
dna = DNA(dnaPath) dna = DNA(dnaPath)
config = RigConfig( config = RigConfig(
@ -241,8 +241,46 @@ def datasBuild():
analog_gui_path=f"{DATA_DIR}/analog_gui.ma", analog_gui_path=f"{DATA_DIR}/analog_gui.ma",
aas_path=f"{DATA_DIR}/additional_assemble_script.py") aas_path=f"{DATA_DIR}/additional_assemble_script.py")
build_rig(dna=dna, config=config) 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" """calib_check = f"{ROOT_DIR}/dna_calibration.mod"
if not os.path.isfile(calib_check): 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!") 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.") 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.") raise ValueError("DNA not found. Please check your preferences and correct the DNA path.")
# Create a progress window # Create a progress window
datasBuild() datasBuild(mod)
cmds.createNode("transform", name="OpenedDNAInfoNode") cmds.createNode("transform", name="OpenedDNAInfoNode")
if not cmds.objExists("metapipefreewindow"): if not cmds.objExists("metapipefreewindow"):
cmds.createNode("transform", name="metapipefreewindow") cmds.createNode("transform", name="metapipefreewindow")
leftPanelButtonV(1) leftPanelButtonV(1)
def datasLoad(): 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 import datas_dna
importlib.reload(datas_dna)
datas_dna.load_dna_data() datas_dna.load_dna_data()
def loadDNA(): 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" dna_datas = f"{ROOT_DIR}/examples/datas_dna.py"
#if not os.path.isfile(dna_datas): #if not os.path.isfile(dna_datas):
@ -296,6 +351,9 @@ def loadDNA():
def datasSave(): def datasSave():
import datas_dna import datas_dna
datas_dna.save_dna_data() datas_dna.save_dna_data()
def datasSaveRaw():
import datas_dna
datas_dna.save_dna_data_raw()
def saveDNA(): def saveDNA():
sys.path.append(f"{ROOT_DIR}/examples") sys.path.append(f"{ROOT_DIR}/examples")
datasSave() datasSave()
@ -1358,14 +1416,17 @@ def codeblock (dnaPath, ROOT_DIR, CHARACTER_NAME, MAIN_PATH, body_type):
lineslists = lines_all[217:220] lineslists = lines_all[217:220]
linesload = lines_all[220:226] 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"] defload = ["def load_dna_data():\n"]
defsave = ["def save_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"{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('f"{DNA_DIR}/{CHARACTER_NAME}.dna"', '"'+dnaPath+'"') for line in lines]
lines = [line.replace('"Ada"','"'+CHARACTER_NAME+'"') for line in lines] lines = [line.replace('"Ada"','"'+CHARACTER_NAME+'"') for line in lines]
linesload = [" " + line for line in linesload] linesload = [" " + line for line in linesload]
lines2 = [" " + line for line in lines2] 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: with open(output_file_path, "w") as output_file:
output_file.write(code_block) 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_DIR: {CHARACTER_DNA}")
print(f"New DNA_Name: {CHARACTER_NAME}") 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) codeblock (CHARACTER_DNA, ROOT_DIR, CHARACTER_NAME, MAIN_PATH, body_type)
if os.path.exists(file_path): if os.path.exists(file_path):
import dat import dat
@ -1416,10 +1478,12 @@ def savePref(textdnaPath, textROOT_DIR, textMAIN_PATH, textbody_type):
dnaPath = dat.dnaPath dnaPath = dat.dnaPath
body_type = dat.body_type body_type = dat.body_type
if chX==1: if chX==1:
cmds.deleteUI("prefWindow", window=True) if cmds.window("prefWindow", exists=True):
cmds.deleteUI("prefWindow", window=True)
mFree_window() mFree_window()
else: 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): def prefUI(dnaPath, ROOT_DIR, MAIN_PATH, body_type):
heightSpa=20 heightSpa=20
@ -1521,7 +1585,7 @@ def mFree_window():
butW=44 butW=44
offsetTop=0 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) 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) 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) b4=cmds.symbolButton("b4",command=lambda x: prepare_export(), image=iconPath + "UIButton4Pressed.png", enable=False)

View File

@ -12,7 +12,7 @@ else:
source_folder_data = os.path.join(source_folder, "data") source_folder_data = os.path.join(source_folder, "data")
source_folder_icons = os.path.join(source_folder, "Icons") source_folder_icons = os.path.join(source_folder, "Icons")
source_folder_scripts = os.path.join(source_folder, "scripts") 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_data = destination_folder + "/data"
destination_folder_icons = destination_folder + "/Icons" destination_folder_icons = destination_folder + "/Icons"
destination_folder_scripts = "C:/Arts and Spells/Scripts" destination_folder_scripts = "C:/Arts and Spells/Scripts"

46
metapipe.py Normal file
View File

@ -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.")