Update definition.py
This commit is contained in:
parent
9f91ea8e56
commit
4b24277b84
@ -35,258 +35,167 @@ class DefinitionTab(QtWidgets.QWidget):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(DefinitionTab, self).__init__(parent)
|
super(DefinitionTab, self).__init__(parent)
|
||||||
self._setup_ui()
|
self._setup_ui()
|
||||||
self._create_connections()
|
|
||||||
|
|
||||||
def _setup_ui(self):
|
def _setup_ui(self):
|
||||||
"""设置UI布局"""
|
"""设置UI布局"""
|
||||||
# === Main Layout ===
|
# === Main Layout ===
|
||||||
self.main_layout = QtWidgets.QHBoxLayout(self)
|
self.main_layout = QtWidgets.QVBoxLayout(self)
|
||||||
self.main_layout.setContentsMargins(2, 2, 2, 2)
|
self.main_layout.setContentsMargins(4, 4, 4, 4)
|
||||||
self.main_layout.setSpacing(2)
|
self.main_layout.setSpacing(4)
|
||||||
|
|
||||||
# 创建左侧和右侧面板
|
# === 创建水平分割布局 ===
|
||||||
self.left_panel = self._create_left_panel()
|
self.splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
|
||||||
self.right_panel = self._create_right_panel()
|
|
||||||
|
|
||||||
self.main_layout.addWidget(self.left_panel, 1) # 1:3比例
|
# === 左侧区域 ===
|
||||||
self.main_layout.addWidget(self.right_panel, 3)
|
left_widget = QtWidgets.QWidget()
|
||||||
|
left_layout = QtWidgets.QVBoxLayout(left_widget)
|
||||||
|
left_layout.setContentsMargins(4, 8, 4, 4)
|
||||||
|
left_layout.setSpacing(4)
|
||||||
|
|
||||||
def _create_left_panel(self):
|
# LODs标题
|
||||||
"""创建左侧面板"""
|
lod_title = QtWidgets.QLabel("LODs")
|
||||||
# === Widget ===
|
lod_title.setStyleSheet("color: #00A5FF;")
|
||||||
widget = QtWidgets.QWidget()
|
|
||||||
|
|
||||||
# === Layout ===
|
# LOD列表
|
||||||
layout = QtWidgets.QVBoxLayout(widget)
|
|
||||||
layout.setContentsMargins(5, 5, 5, 5)
|
|
||||||
layout.setSpacing(5)
|
|
||||||
|
|
||||||
# LODs列表
|
|
||||||
lod_group = QtWidgets.QGroupBox("LODs")
|
|
||||||
lod_layout = QtWidgets.QVBoxLayout()
|
|
||||||
self.lod_list = QtWidgets.QListWidget()
|
self.lod_list = QtWidgets.QListWidget()
|
||||||
|
self.lod_list.setStyleSheet("""
|
||||||
|
QListWidget {
|
||||||
|
background: #232323;
|
||||||
|
border: 1px solid #555555;
|
||||||
|
}
|
||||||
|
QListWidget::item {
|
||||||
|
height: 24px;
|
||||||
|
padding: 0px 4px;
|
||||||
|
border-bottom: 1px solid #383838;
|
||||||
|
}
|
||||||
|
QListWidget::item:selected {
|
||||||
|
background: #4D4D4D;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
# 添加LOD项
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
self.lod_list.addItem(f"LOD {i}")
|
item = QtWidgets.QListWidgetItem(f"LOD {i}")
|
||||||
lod_layout.addWidget(self.lod_list)
|
item.setIcon(QtGui.QIcon(":mesh.png"))
|
||||||
|
self.lod_list.addItem(item)
|
||||||
|
|
||||||
# Define Joint按钮
|
# 定义LOD关节按钮
|
||||||
self.define_joint_btn = QtWidgets.QPushButton("Define Joint For LOD")
|
define_lod_btn = QtWidgets.QPushButton("定义LOD关节")
|
||||||
lod_layout.addWidget(self.define_joint_btn)
|
define_lod_btn.setIcon(QtGui.QIcon(":kinJoint.png"))
|
||||||
|
|
||||||
lod_group.setLayout(lod_layout)
|
# Meshes标题
|
||||||
layout.addWidget(lod_group)
|
mesh_title = QtWidgets.QLabel("Meshes [010/54]")
|
||||||
|
mesh_title.setStyleSheet("color: #00A5FF;")
|
||||||
|
|
||||||
return widget
|
# Mesh列表
|
||||||
|
self.mesh_list = QtWidgets.QListWidget()
|
||||||
|
self.mesh_list.setStyleSheet(self.lod_list.styleSheet())
|
||||||
|
|
||||||
def _create_right_panel(self):
|
# 添加Mesh项
|
||||||
"""创建右侧面板"""
|
mesh_items = [
|
||||||
# === Widget ===
|
("head_lod0_mesh", "000"),
|
||||||
widget = QtWidgets.QWidget()
|
("teeth_lod0_mesh", "001"),
|
||||||
|
("saliva_lod0_mesh", "002"),
|
||||||
# === Layout ===
|
("eyeLeft_lod0_mesh", "003"),
|
||||||
layout = QtWidgets.QVBoxLayout(widget)
|
("eyeRight_lod0_mesh", "004")
|
||||||
layout.setContentsMargins(5, 5, 5, 5)
|
|
||||||
layout.setSpacing(5)
|
|
||||||
|
|
||||||
# 创建各个部分
|
|
||||||
self.meshes_widget = self._create_meshes_section()
|
|
||||||
self.joints_widget = self._create_joints_section()
|
|
||||||
self.blend_shapes_widget = self._create_blend_shapes_section()
|
|
||||||
self.animated_map_widget = self._create_animated_map_section()
|
|
||||||
|
|
||||||
# 添加到布局
|
|
||||||
layout.addWidget(self.meshes_widget)
|
|
||||||
layout.addWidget(self.joints_widget)
|
|
||||||
layout.addWidget(self.blend_shapes_widget)
|
|
||||||
layout.addWidget(self.animated_map_widget)
|
|
||||||
|
|
||||||
# 添加操作按钮区域
|
|
||||||
self.operation_widget = self._create_operation_section()
|
|
||||||
layout.addWidget(self.operation_widget)
|
|
||||||
|
|
||||||
return widget
|
|
||||||
|
|
||||||
def _create_meshes_section(self):
|
|
||||||
"""创建Meshes部分"""
|
|
||||||
# === Widget ===
|
|
||||||
group = QtWidgets.QGroupBox("Meshes [010/54]")
|
|
||||||
|
|
||||||
# === Layout ===
|
|
||||||
layout = QtWidgets.QVBoxLayout(group)
|
|
||||||
|
|
||||||
# 列表
|
|
||||||
self.meshes_list = QtWidgets.QListWidget()
|
|
||||||
meshes = [
|
|
||||||
"head_lod0_mesh (000)",
|
|
||||||
"teeth_lod0_mesh (001)",
|
|
||||||
"saliva_lod0_mesh (002)",
|
|
||||||
"eyeLeft_lod0_mesh (003)",
|
|
||||||
"eyeRight_lod0_mesh (004)",
|
|
||||||
"eyeshell_lod0_mesh (005)",
|
|
||||||
"eyelashes_lod0_mesh (006)",
|
|
||||||
"eyeEdge_lod0_mesh (007)"
|
|
||||||
]
|
]
|
||||||
for mesh in meshes:
|
|
||||||
self.meshes_list.addItem(mesh)
|
|
||||||
|
|
||||||
layout.addWidget(self.meshes_list)
|
for name, index in mesh_items:
|
||||||
|
item = QtWidgets.QListWidgetItem(f"{name} {index}")
|
||||||
|
item.setIcon(QtGui.QIcon(":mesh.png"))
|
||||||
|
self.mesh_list.addItem(item)
|
||||||
|
|
||||||
# Create Geometry按钮
|
# 添加到左侧布局
|
||||||
self.create_geo_btn = QtWidgets.QPushButton("Create Geometry")
|
left_layout.addWidget(lod_title)
|
||||||
layout.addWidget(self.create_geo_btn)
|
left_layout.addWidget(self.lod_list)
|
||||||
|
left_layout.addWidget(define_lod_btn)
|
||||||
|
left_layout.addWidget(mesh_title)
|
||||||
|
left_layout.addWidget(self.mesh_list)
|
||||||
|
|
||||||
return group
|
# === 右侧区域 ===
|
||||||
|
right_widget = QtWidgets.QWidget()
|
||||||
|
right_layout = QtWidgets.QVBoxLayout(right_widget)
|
||||||
|
right_layout.setContentsMargins(4, 8, 4, 4)
|
||||||
|
right_layout.setSpacing(4)
|
||||||
|
|
||||||
def _create_joints_section(self):
|
# Joints标题和列表
|
||||||
"""创建Joints部分"""
|
joints_title = QtWidgets.QLabel("Joints [840/870]")
|
||||||
# === Widget ===
|
joints_title.setStyleSheet("color: #00A5FF;")
|
||||||
group = QtWidgets.QGroupBox("Joints [840/870]")
|
|
||||||
|
|
||||||
# === Layout ===
|
|
||||||
layout = QtWidgets.QVBoxLayout(group)
|
|
||||||
|
|
||||||
# 列表
|
|
||||||
self.joints_list = QtWidgets.QListWidget()
|
self.joints_list = QtWidgets.QListWidget()
|
||||||
joints = [
|
self.joints_list.setStyleSheet(self.lod_list.styleSheet())
|
||||||
"FACIAL_C_NeckB Group: 001",
|
|
||||||
"FACIAL_L_NeckB1 Group: 002",
|
|
||||||
"FACIAL_R_NeckB1 Group: 003",
|
|
||||||
"FACIAL_L_NeckB2 Group: 002",
|
|
||||||
"FACIAL_R_NeckB2 Group: 003",
|
|
||||||
"FACIAL_C12PV_NeckB1 Group: 001"
|
|
||||||
]
|
|
||||||
for joint in joints:
|
|
||||||
self.joints_list.addItem(joint)
|
|
||||||
|
|
||||||
layout.addWidget(self.joints_list)
|
# BlendShapes标题和列表
|
||||||
return group
|
blendshapes_title = QtWidgets.QLabel("Blend Shapes [782/782]")
|
||||||
|
blendshapes_title.setStyleSheet("color: #00A5FF;")
|
||||||
|
|
||||||
def _create_blend_shapes_section(self):
|
self.blendshapes_list = QtWidgets.QListWidget()
|
||||||
"""创建Blend Shapes部分"""
|
self.blendshapes_list.setStyleSheet(self.lod_list.styleSheet())
|
||||||
# === Widget ===
|
|
||||||
group = QtWidgets.QGroupBox("Blend Shapes [782/782]")
|
|
||||||
|
|
||||||
# === Layout ===
|
# AnimatedMap标题和列表
|
||||||
layout = QtWidgets.QVBoxLayout(group)
|
animatedmap_title = QtWidgets.QLabel("AnimatedMap [082/82]")
|
||||||
|
animatedmap_title.setStyleSheet("color: #00A5FF;")
|
||||||
|
|
||||||
# 列表
|
self.animatedmap_list = QtWidgets.QListWidget()
|
||||||
self.blend_shapes_list = QtWidgets.QListWidget()
|
self.animatedmap_list.setStyleSheet(self.lod_list.styleSheet())
|
||||||
shapes = [
|
|
||||||
"brow_down_L 000",
|
|
||||||
"brow_down_R 001",
|
|
||||||
"brow_lateral_L 002",
|
|
||||||
"brow_lateral_R 003",
|
|
||||||
"brow_raiseIn_L 004",
|
|
||||||
"brow_raiseIn_R 005"
|
|
||||||
]
|
|
||||||
for shape in shapes:
|
|
||||||
self.blend_shapes_list.addItem(shape)
|
|
||||||
|
|
||||||
layout.addWidget(self.blend_shapes_list)
|
# 添加到右侧布局
|
||||||
return group
|
right_layout.addWidget(joints_title)
|
||||||
|
right_layout.addWidget(self.joints_list)
|
||||||
|
right_layout.addWidget(blendshapes_title)
|
||||||
|
right_layout.addWidget(self.blendshapes_list)
|
||||||
|
right_layout.addWidget(animatedmap_title)
|
||||||
|
right_layout.addWidget(self.animatedmap_list)
|
||||||
|
|
||||||
def _create_animated_map_section(self):
|
# === 底部功能区域 ===
|
||||||
"""创建AnimatedMap部分"""
|
bottom_widget = QtWidgets.QWidget()
|
||||||
# === Widget ===
|
bottom_layout = QtWidgets.QHBoxLayout(bottom_widget)
|
||||||
group = QtWidgets.QGroupBox("AnimatedMap [082/82]")
|
bottom_layout.setContentsMargins(4, 4, 4, 4)
|
||||||
|
bottom_layout.setSpacing(4)
|
||||||
|
|
||||||
# === Layout ===
|
# 创建三个功能区
|
||||||
layout = QtWidgets.QVBoxLayout(group)
|
for title, buttons in [
|
||||||
|
("导入", [
|
||||||
|
("导入关节和表情", ":kinJoint.png"),
|
||||||
|
("导入几何体", ":mesh.png"),
|
||||||
|
("导入蒙皮数据", ":skinWeight.png"),
|
||||||
|
("导入混合变形目标", ":blendShape.png")
|
||||||
|
]),
|
||||||
|
("创建", [
|
||||||
|
("创建混合形状", ":blendShape.png"),
|
||||||
|
("蒙皮到皮", ":skinWeight.png"),
|
||||||
|
("取消蒙皮", ":skinWeight.png")
|
||||||
|
]),
|
||||||
|
("工具", [
|
||||||
|
("重新定位关节位置", ":kinJoint.png"),
|
||||||
|
("快速创建蒙皮设置", ":skinWeight.png")
|
||||||
|
])
|
||||||
|
]:
|
||||||
|
group = QtWidgets.QGroupBox(title)
|
||||||
|
group_layout = QtWidgets.QVBoxLayout(group)
|
||||||
|
group_layout.setContentsMargins(4, 4, 4, 8)
|
||||||
|
group_layout.setSpacing(4)
|
||||||
|
|
||||||
# 列表
|
# 添加按钮
|
||||||
self.animated_map_list = QtWidgets.QListWidget()
|
for text, icon in buttons:
|
||||||
maps = [
|
btn = QtWidgets.QPushButton(text)
|
||||||
"head_cm2_color.head_wm2.browsDown 000",
|
btn.setIcon(QtGui.QIcon(icon))
|
||||||
"head_cm2_color.head_wm2.browsDown 001",
|
btn.setFixedHeight(24)
|
||||||
"head_cm2_color.head_wm2.browsLate 002",
|
group_layout.addWidget(btn)
|
||||||
"head_cm2_color.head_wm2.browsLate 003",
|
|
||||||
"head_cm1_color.head_wm1.browsRais 004",
|
|
||||||
"head_cm1_color.head_wm1.browsRais 005"
|
|
||||||
]
|
|
||||||
for map_item in maps:
|
|
||||||
self.animated_map_list.addItem(map_item)
|
|
||||||
|
|
||||||
layout.addWidget(self.animated_map_list)
|
# 添加弹性空间到底部
|
||||||
return group
|
group_layout.addStretch()
|
||||||
|
bottom_layout.addWidget(group)
|
||||||
|
|
||||||
def _create_operation_section(self):
|
# 添加到分割器和主布局
|
||||||
"""创建操作区域"""
|
self.splitter.addWidget(left_widget)
|
||||||
# === Widget ===
|
self.splitter.addWidget(right_widget)
|
||||||
widget = QtWidgets.QWidget()
|
|
||||||
|
|
||||||
# === Layout ===
|
self.main_layout.addWidget(self.splitter)
|
||||||
layout = QtWidgets.QVBoxLayout(widget)
|
self.main_layout.addWidget(bottom_widget)
|
||||||
|
|
||||||
# Write部分
|
# 设置分割器初始比例为均等
|
||||||
write_group = QtWidgets.QGroupBox("Write")
|
self.splitter.setSizes([int(self.width() * 0.5), int(self.width() * 0.5)])
|
||||||
write_layout = QtWidgets.QVBoxLayout()
|
|
||||||
write_buttons = [
|
|
||||||
"Write Neutral Pose Joint Position",
|
|
||||||
"Write Geometry",
|
|
||||||
"Write Skin Weights",
|
|
||||||
"Write Blend Shapes Targets"
|
|
||||||
]
|
|
||||||
for text in write_buttons:
|
|
||||||
btn = QtWidgets.QPushButton(text)
|
|
||||||
write_layout.addWidget(btn)
|
|
||||||
write_group.setLayout(write_layout)
|
|
||||||
layout.addWidget(write_group)
|
|
||||||
|
|
||||||
# Create部分
|
|
||||||
create_group = QtWidgets.QGroupBox("Create")
|
|
||||||
create_layout = QtWidgets.QVBoxLayout()
|
|
||||||
create_buttons = [
|
|
||||||
"Create Blend Shapes For Mesh",
|
|
||||||
"Bind Skin For Mesh",
|
|
||||||
"Unbind Skin For Mesh"
|
|
||||||
]
|
|
||||||
for text in create_buttons:
|
|
||||||
btn = QtWidgets.QPushButton(text)
|
|
||||||
create_layout.addWidget(btn)
|
|
||||||
create_group.setLayout(create_layout)
|
|
||||||
layout.addWidget(create_group)
|
|
||||||
|
|
||||||
# Tools部分
|
|
||||||
tools_group = QtWidgets.QGroupBox("Tools")
|
|
||||||
tools_layout = QtWidgets.QVBoxLayout()
|
|
||||||
tools_buttons = [
|
|
||||||
"New Neutral Joint Transform",
|
|
||||||
"Quickly Create Presets"
|
|
||||||
]
|
|
||||||
for text in tools_buttons:
|
|
||||||
btn = QtWidgets.QPushButton(text)
|
|
||||||
tools_layout.addWidget(btn)
|
|
||||||
tools_group.setLayout(tools_layout)
|
|
||||||
layout.addWidget(tools_group)
|
|
||||||
|
|
||||||
return widget
|
|
||||||
|
|
||||||
def _create_connections(self):
|
|
||||||
"""创建信号连接"""
|
|
||||||
# LOD列表选择
|
|
||||||
self.lod_list.currentItemChanged.connect(self._on_lod_changed)
|
|
||||||
|
|
||||||
# Define Joint按钮
|
|
||||||
self.define_joint_btn.clicked.connect(self._on_define_joint)
|
|
||||||
|
|
||||||
# Create Geometry按钮
|
|
||||||
self.create_geo_btn.clicked.connect(self._on_create_geometry)
|
|
||||||
|
|
||||||
# ================================ 事件函数 ================================
|
|
||||||
def _on_lod_changed(self, current, previous):
|
|
||||||
"""LOD选择改变"""
|
|
||||||
# TODO: 实现LOD切换逻辑
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _on_define_joint(self):
|
|
||||||
"""Define Joint按钮点击"""
|
|
||||||
# TODO: 实现Define Joint逻辑
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _on_create_geometry(self):
|
|
||||||
"""Create Geometry按钮点击"""
|
|
||||||
# TODO: 实现Create Geometry逻辑
|
|
||||||
pass
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
Loading…
Reference in New Issue
Block a user