-
Notifications
You must be signed in to change notification settings - Fork 0
/
USDConverterUI_2.py
170 lines (137 loc) · 5.93 KB
/
USDConverterUI_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import os, sys
from pathlib import Path
scripts = os.getenv('HOUDINI_SCRIPT_PATH')
SRC_PATH = str(scripts + '/USD_Megascan_Importer')
if str(SRC_PATH) not in sys.path:
sys.path.append(str(SRC_PATH))
from PySide2.QtCore import Qt
from PySide2.QtGui import QFont, QIcon
from PySide2.QtWidgets import (QComboBox, QFrame, QHBoxLayout, QLabel,
QLineEdit, QListWidget, QMainWindow,
QMessageBox, QPushButton, QRadioButton,
QStatusBar, QVBoxLayout, QWidget, QApplication)
import loadPanel
from EditListUI import ExportPathVarUI
from Help_UI import HelpUI
import master_conversion_USD
class USD_UI(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setWindowTitle("Megascan USD Asset Converter")
self.setWindowIcon(QIcon(SRC_PATH + "\\bin\\icons\\main.png"))
self.LightGreyFont = QFont("Courier", 8)
self._UI_ImportSection()
self._createUI()
#--------- UI MAIN ---------#
def _createUI(self):
self.setStatusBar(QStatusBar(self))
# Step 1
PathPrefixLabel = QLabel("Set a Default Path Prefix for Asset Export Path")
PathPrefixLabel.setStyleSheet( "font-size : 10pt; color: lightgrey; font-weight:bold;")
self.SetPathPrefixCombo = QComboBox()
self.SetPathPrefixCombo.setFixedWidth(200)
self.EditPathWindow = ExportPathVarUI(self)
self.SetPathPrefixCombo.addItems(self.EditPathWindow._getList())
EditPathSet = QPushButton("Edit List")
EditPathSet.clicked.connect(self.EditList_was_clicked)
PathPrefixLabel2 = QLabel("Default $HIP/usd/assets would be good if you need to move around your Project")
PathPrefixLabel2.setWordWrap(True)
PathPrefixLabel2.setFont(self.LightGreyFont)
# Step 2
HLine = QFrame()
HLine.setFrameShape(QFrame.HLine)
Frame1 = QFrame()
Frame1.setFrameShape(QFrame.Box)
self.convert = QPushButton("Convert into USD")
self.convert.setStyleSheet("color: rgb(0, 255, 155);")
self.help = QPushButton("Help")
self.help.setStyleSheet("color: rgb(255, 80, 80);")
self.help.clicked.connect(self.help_was_clicked)
self.convert.clicked.connect(self.convert_was_clicked)
## Path Layout
LayHor1 = QHBoxLayout()
LayHor1.addStretch()
LayHor1.addWidget(self.SetPathPrefixCombo)
LayHor1.addStretch()
LayHor1.addWidget(EditPathSet)
LayHor1.addStretch()
## Final Layout
FinalLayout = QHBoxLayout()
FinalLayout.addWidget(self.help)
FinalLayout.addWidget(self.convert)
FinalLayout.setAlignment(self.help, Qt.AlignHCenter)
FinalLayout.setAlignment(self.convert, Qt.AlignHCenter)
## Core Layout
CoreLayout = QVBoxLayout()
CoreLayout.addWidget(PathPrefixLabel)
CoreLayout.addLayout(LayHor1)
CoreLayout.addWidget(PathPrefixLabel2)
CoreLayout.addWidget(HLine)
CoreLayout.addSpacing(20)
CoreLayout.addLayout(self.ImportLayout)
CoreLayout.addSpacing(20)
CoreLayout.addLayout(FinalLayout)
CoreLayout.addStretch()
Container = QWidget()
Container.setLayout(CoreLayout)
self.setCentralWidget(Container)
#--------- UI Import Section ---------#
def _UI_ImportSection(self):
label1 = QLabel("1. Import Megascan Asset Using Bridge and MSPlugin and select the *Asset Subnet*.")
ImportHeading = QLabel("Import Settings")
ImportHeading.setStyleSheet( "font-size : 10pt; color: lightgrey; font-weight:bold;")
label2 = QLabel("2. Select One of the Import Method.")
self.Single = QRadioButton ("Single Mesh")
self.Variant = QRadioButton ("Multiple Variant Mesh LOD0 SOPS")
self.Split = QRadioButton ("Sub-Split Variant Meshes inside LOD0")
self.Single.toggled.connect(self._updateImportMethod)
self.Variant.toggled.connect(self._updateImportMethod)
self.Split.toggled.connect(self._updateImportMethod)
self.Single.setStatusTip("Creates Single Asset for Single Mesh")
self.Variant.setStatusTip("Creates Individual Asset for each of the collection Items of Single Meshes.")
self.Split.setStatusTip("Creates Single Asset containing all variant of each collection items.")
## Method Radio Buttons
ButtonLayout = QHBoxLayout()
ButtonLayout.addStretch()
ButtonLayout.addWidget(self.Single)
ButtonLayout.addWidget(self.Variant)
ButtonLayout.addWidget(self.Split)
ButtonLayout.addStretch()
self.ImportLayout = QVBoxLayout()
self.ImportLayout.addWidget(ImportHeading)
self.ImportLayout.setAlignment(ImportHeading, Qt.AlignHCenter)
self.ImportLayout.addSpacing(10)
self.ImportLayout.addWidget(label1)
self.ImportLayout.addSpacing(10)
self.ImportLayout.addWidget(label2)
self.ImportLayout.addLayout(ButtonLayout)
#--------- Choose Import Method ---------#
def _updateImportMethod(self, data):
...
#--------- Help ---------#
def convert_was_clicked(self):
if self.Single.isChecked():
master_conversion_USD.mainSingle()
print("single")
elif self.Variant.isChecked():
master_conversion_USD.SOPVariants()
print("Variant")
elif self.Split.isChecked():
master_conversion_USD.subSOPVariants()
print("Split")
#--------- Help ---------#
def help_was_clicked(self):
print("help")
self.H = HelpUI()
self.H.show()
def EditList_was_clicked(self):
self.EditPathWindow.show()
def main():
# app = QApplication()
A = USD_UI()
A.show()
# app.exec_()
# if __name__ == '__main__':
# main()
main()