#!/usr/bin/env python # -*- coding: utf-8 -*- #===================================== 1. Module Imports ===================================== import maya.OpenMayaUI as omui from scripts import config import maya.cmds as cmds import maya.mel as mel import webbrowser import sys import os from scripts import config try: from PySide2 import QtCore, QtGui, QtWidgets from shiboken2 import wrapInstance print("从PySide2加载Qt和shiboken2") except ImportError: try: from PySide6 import QtCore, QtGui, QtWidgets from shiboken6 import wrapInstance print("从PySide6加载Qt和shiboken6") except ImportError: try: from PySide import QtCore, QtGui, QtWidgets from shiboken import wrapInstance print("从PySide加载Qt和shiboken") except ImportError as e: print(f"Qt加载失败: {str(e)}") QtCore = QtGui = QtWidgets = None wrapInstance = None class BehaviourTab(QtWidgets.QWidget): def __init__(self, parent=None): super(BehaviourTab, self).__init__(parent) self._setup_ui() self._create_connections() def _setup_ui(self): """设置UI布局""" # 创建主布局 self.main_layout = QtWidgets.QHBoxLayout(self) self.main_layout.setContentsMargins(2, 2, 2, 2) self.main_layout.setSpacing(2) # 创建左右两个主面板 self.raw_control_widget = self._create_raw_control() self.blend_shapes_widget = self._create_blend_shapes() self.main_layout.addWidget(self.raw_control_widget) self.main_layout.addWidget(self.blend_shapes_widget) def _create_raw_control(self): """创建Raw Control部分""" # === Widget === widget = QtWidgets.QWidget() # === Layout === layout = QtWidgets.QVBoxLayout(widget) layout.setContentsMargins(5, 5, 5, 5) layout.setSpacing(5) # 标题 title_layout = QtWidgets.QHBoxLayout() title_label = QtWidgets.QLabel("Raw Control [814/814]") title_layout.addWidget(title_label) layout.addLayout(title_layout) # 搜索框 self.search_edit = QtWidgets.QLineEdit() self.search_edit.setPlaceholderText("搜索...") layout.addWidget(self.search_edit) # BlendShape列表 self.blend_list = QtWidgets.QListWidget() layout.addWidget(self.blend_list) # 数值调节 value_layout = QtWidgets.QHBoxLayout() self.value_spin = QtWidgets.QDoubleSpinBox() self.value_spin.setValue(0.010) self.value_spin.setDecimals(3) value_layout.addWidget(self.value_spin) layout.addLayout(value_layout) # 过滤按钮组 filter_layout = QtWidgets.QHBoxLayout() self.filter_buttons = [] for text in ["全部", "2", "3", "4", "5", "6"]: btn = QtWidgets.QPushButton(text) btn.setCheckable(True) filter_layout.addWidget(btn) self.filter_buttons.append(btn) layout.addLayout(filter_layout) return widget def _create_blend_shapes(self): """创建Related Blend Shapes部分""" # === Widget === widget = QtWidgets.QWidget() # === Layout === layout = QtWidgets.QVBoxLayout(widget) layout.setContentsMargins(5, 5, 5, 5) layout.setSpacing(5) # 标题 title_layout = QtWidgets.QHBoxLayout() title_label = QtWidgets.QLabel("Related Blend Shapes [858/858]") title_layout.addWidget(title_label) layout.addLayout(title_layout) # BlendShape列表 self.related_list = QtWidgets.QListWidget() layout.addWidget(self.related_list) # 数值调节 value_layout = QtWidgets.QHBoxLayout() self.related_value_spin = QtWidgets.QDoubleSpinBox() self.related_value_spin.setValue(0.000) self.related_value_spin.setDecimals(3) value_layout.addWidget(self.related_value_spin) layout.addLayout(value_layout) # 操作按钮组 - 第一行 op_layout1 = QtWidgets.QHBoxLayout() op_buttons1 = [ ("翻转目标", "flip.png"), ("镜像目标", "mirror.png"), ("查找翻转目标", "find_flip.png") ] for text, icon in op_buttons1: btn = QtWidgets.QPushButton(text) if icon: btn.setIcon(QtGui.QIcon(f"{config.ICONS_PATH}/{icon}")) op_layout1.addWidget(btn) layout.addLayout(op_layout1) # 操作按钮组 - 第二行 op_layout2 = QtWidgets.QHBoxLayout() op_buttons2 = [ ("添加混合目标", "add.png"), ("删除混合目标", "delete.png"), ("批量混合目标", "batch.png") ] for text, icon in op_buttons2: btn = QtWidgets.QPushButton(text) if icon: btn.setIcon(QtGui.QIcon(f"{config.ICONS_PATH}/{icon}")) op_layout2.addWidget(btn) layout.addLayout(op_layout2) # 功能按钮组 func_layout = QtWidgets.QHBoxLayout() func_buttons = ["PSD", "BSE", "KEY", "MIR", "ARK", "CTR"] for text in func_buttons: btn = QtWidgets.QPushButton(text) btn.setFixedWidth(40) func_layout.addWidget(btn) layout.addLayout(func_layout) return widget def _create_connections(self): """创建信号连接""" # 搜索框 self.search_edit.textChanged.connect(self._filter_blend_shapes) # 数值调节 self.value_spin.valueChanged.connect(self._update_raw_value) self.related_value_spin.valueChanged.connect(self._update_related_value) # 过滤按钮组 for btn in self.filter_buttons: btn.clicked.connect(self._apply_filter) # ================================ 事件函数 ================================ def _filter_blend_shapes(self, text): """过滤BlendShape列表""" # TODO: 实现过滤逻辑 pass def _update_raw_value(self, value): """更新Raw Control值""" # TODO: 实现更新逻辑 pass def _update_related_value(self, value): """更新Related Blend Shapes值""" # TODO: 实现更新逻辑 pass def _apply_filter(self): """应用过滤器""" # TODO: 实现过滤逻辑 pass if __name__ == "__main__": pass