Update
This commit is contained in:
@@ -59,6 +59,252 @@ class RiggingUI(ui_utils.BaseUI):
|
|||||||
绑定系统UI类 - 负责显示骨骼绑定编辑界面和基础操作
|
绑定系统UI类 - 负责显示骨骼绑定编辑界面和基础操作
|
||||||
继承自BaseUI类,实现绑定系统相关的UI功能
|
继承自BaseUI类,实现绑定系统相关的UI功能
|
||||||
"""
|
"""
|
||||||
|
#======================================= FUNCTIONS ======================================
|
||||||
|
def on_show_event(self, event):
|
||||||
|
"""
|
||||||
|
显示事件处理
|
||||||
|
当面板显示时重置分割器大小
|
||||||
|
"""
|
||||||
|
self.reset_splitter_sizes()
|
||||||
|
super(RiggingUI, self).showEvent(event)
|
||||||
|
|
||||||
|
def reset_splitter_sizes(self):
|
||||||
|
"""
|
||||||
|
重置分割器大小,确保左右栏宽度均等
|
||||||
|
"""
|
||||||
|
if self.splitters["main_splitter"]:
|
||||||
|
width = self.splitters["main_splitter"].width()
|
||||||
|
self.splitters["main_splitter"].setSizes([width // 2, width // 2])
|
||||||
|
|
||||||
|
def on_splitter_moved(self, pos, index):
|
||||||
|
"""
|
||||||
|
分割器移动事件处理
|
||||||
|
记录当前分割器位置
|
||||||
|
"""
|
||||||
|
utils_rigging.update_splitter_position(self.splitters["main_splitter"])
|
||||||
|
|
||||||
|
# 左侧面板 - 骨骼列表操作
|
||||||
|
def add_joint(self):
|
||||||
|
"""
|
||||||
|
添加关节
|
||||||
|
"""
|
||||||
|
utils_rigging.add_joint(self.controls["skeleton_list"])
|
||||||
|
|
||||||
|
def remove_joint(self):
|
||||||
|
"""
|
||||||
|
移除关节
|
||||||
|
"""
|
||||||
|
utils_rigging.remove_joint(self.controls["skeleton_list"])
|
||||||
|
|
||||||
|
def duplicate_joint(self):
|
||||||
|
"""
|
||||||
|
复制关节
|
||||||
|
"""
|
||||||
|
utils_rigging.duplicate_joint(self.controls["skeleton_list"])
|
||||||
|
|
||||||
|
def on_joint_selection_changed(self):
|
||||||
|
"""
|
||||||
|
关节选择变化事件
|
||||||
|
更新关节属性面板
|
||||||
|
"""
|
||||||
|
utils_rigging.update_joint_properties(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
self.controls["joint_name_input"],
|
||||||
|
self.controls["joint_x_input"],
|
||||||
|
self.controls["joint_y_input"],
|
||||||
|
self.controls["joint_z_input"],
|
||||||
|
self.controls["joint_rx_input"],
|
||||||
|
self.controls["joint_ry_input"],
|
||||||
|
self.controls["joint_rz_input"],
|
||||||
|
self.controls["joint_sx_input"],
|
||||||
|
self.controls["joint_sy_input"],
|
||||||
|
self.controls["joint_sz_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# 左侧面板 - 控制器列表操作
|
||||||
|
def add_controller(self):
|
||||||
|
"""
|
||||||
|
添加控制器
|
||||||
|
"""
|
||||||
|
utils_rigging.add_controller(self.controls["controller_list"])
|
||||||
|
|
||||||
|
def remove_controller(self):
|
||||||
|
"""
|
||||||
|
移除控制器
|
||||||
|
"""
|
||||||
|
utils_rigging.remove_controller(self.controls["controller_list"])
|
||||||
|
|
||||||
|
def duplicate_controller(self):
|
||||||
|
"""
|
||||||
|
复制控制器
|
||||||
|
"""
|
||||||
|
utils_rigging.duplicate_controller(self.controls["controller_list"])
|
||||||
|
|
||||||
|
def on_controller_selection_changed(self):
|
||||||
|
"""
|
||||||
|
控制器选择变化事件
|
||||||
|
更新控制器属性
|
||||||
|
"""
|
||||||
|
utils_rigging.update_controller_properties(self.controls["controller_list"])
|
||||||
|
|
||||||
|
# 右侧面板 - 关节属性
|
||||||
|
def on_joint_name_changed(self):
|
||||||
|
"""
|
||||||
|
关节名称变化事件
|
||||||
|
"""
|
||||||
|
utils_rigging.update_joint_name(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
self.controls["joint_name_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def on_joint_position_changed(self, axis):
|
||||||
|
"""
|
||||||
|
关节位置变化事件
|
||||||
|
"""
|
||||||
|
utils_rigging.update_joint_position(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
axis,
|
||||||
|
self.controls[f"joint_{axis}_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def on_joint_rotation_changed(self, axis):
|
||||||
|
"""
|
||||||
|
关节旋转变化事件
|
||||||
|
"""
|
||||||
|
utils_rigging.update_joint_rotation(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
axis,
|
||||||
|
self.controls[f"joint_r{axis}_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def on_joint_scale_changed(self, axis):
|
||||||
|
"""
|
||||||
|
关节缩放变化事件
|
||||||
|
"""
|
||||||
|
utils_rigging.update_joint_scale(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
axis,
|
||||||
|
self.controls[f"joint_s{axis}_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def apply_joint_properties(self):
|
||||||
|
"""
|
||||||
|
应用关节属性
|
||||||
|
"""
|
||||||
|
utils_rigging.apply_joint_properties(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
self.controls["joint_name_input"],
|
||||||
|
self.controls["joint_x_input"],
|
||||||
|
self.controls["joint_y_input"],
|
||||||
|
self.controls["joint_z_input"],
|
||||||
|
self.controls["joint_rx_input"],
|
||||||
|
self.controls["joint_ry_input"],
|
||||||
|
self.controls["joint_rz_input"],
|
||||||
|
self.controls["joint_sx_input"],
|
||||||
|
self.controls["joint_sy_input"],
|
||||||
|
self.controls["joint_sz_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def reset_joint_properties(self):
|
||||||
|
"""
|
||||||
|
重置关节属性
|
||||||
|
"""
|
||||||
|
utils_rigging.reset_joint_properties(
|
||||||
|
self.controls["skeleton_list"],
|
||||||
|
self.controls["joint_name_input"],
|
||||||
|
self.controls["joint_x_input"],
|
||||||
|
self.controls["joint_y_input"],
|
||||||
|
self.controls["joint_z_input"],
|
||||||
|
self.controls["joint_rx_input"],
|
||||||
|
self.controls["joint_ry_input"],
|
||||||
|
self.controls["joint_rz_input"],
|
||||||
|
self.controls["joint_sx_input"],
|
||||||
|
self.controls["joint_sy_input"],
|
||||||
|
self.controls["joint_sz_input"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# 右侧面板 - 绑定工具
|
||||||
|
def create_binding(self):
|
||||||
|
"""
|
||||||
|
创建绑定
|
||||||
|
"""
|
||||||
|
utils_rigging.create_binding()
|
||||||
|
|
||||||
|
def copy_skin(self):
|
||||||
|
"""
|
||||||
|
复制蒙皮
|
||||||
|
"""
|
||||||
|
utils_rigging.copy_skin()
|
||||||
|
|
||||||
|
def mirror_skin(self):
|
||||||
|
"""
|
||||||
|
镜像蒙皮
|
||||||
|
"""
|
||||||
|
utils_rigging.mirror_skin()
|
||||||
|
|
||||||
|
def paint_weights(self):
|
||||||
|
"""
|
||||||
|
绘制权重
|
||||||
|
"""
|
||||||
|
utils_rigging.paint_weights()
|
||||||
|
|
||||||
|
# 底部工具面板 - DNA操作
|
||||||
|
def import_dna(self):
|
||||||
|
"""
|
||||||
|
导入DNA
|
||||||
|
"""
|
||||||
|
utils_rigging.import_dna()
|
||||||
|
|
||||||
|
def export_dna(self):
|
||||||
|
"""
|
||||||
|
导出DNA
|
||||||
|
"""
|
||||||
|
utils_rigging.export_dna()
|
||||||
|
|
||||||
|
def calibrate_dna(self):
|
||||||
|
"""
|
||||||
|
校准DNA
|
||||||
|
"""
|
||||||
|
utils_rigging.calibrate_dna()
|
||||||
|
|
||||||
|
# 底部工具面板 - 骨骼工具
|
||||||
|
def import_skeleton(self):
|
||||||
|
"""
|
||||||
|
导入骨骼
|
||||||
|
"""
|
||||||
|
utils_rigging.import_skeleton()
|
||||||
|
|
||||||
|
def export_skeleton(self):
|
||||||
|
"""
|
||||||
|
导出骨骼
|
||||||
|
"""
|
||||||
|
utils_rigging.export_skeleton()
|
||||||
|
|
||||||
|
def calibrate_skeleton(self):
|
||||||
|
"""
|
||||||
|
校准骨骼
|
||||||
|
"""
|
||||||
|
utils_rigging.calibrate_skeleton()
|
||||||
|
|
||||||
|
# 底部工具面板 - 绑定工具
|
||||||
|
def generate_controllers(self):
|
||||||
|
"""
|
||||||
|
生成控制器
|
||||||
|
"""
|
||||||
|
utils_rigging.generate_controllers()
|
||||||
|
|
||||||
|
def generate_body(self):
|
||||||
|
"""
|
||||||
|
生成身体
|
||||||
|
"""
|
||||||
|
utils_rigging.generate_body()
|
||||||
|
|
||||||
|
def clean_rigging(self):
|
||||||
|
"""
|
||||||
|
清理绑定
|
||||||
|
"""
|
||||||
|
utils_rigging.clean_rigging()
|
||||||
|
|
||||||
#========================================== INIT ========================================
|
#========================================== INIT ========================================
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
@@ -529,18 +775,60 @@ class RiggingUI(ui_utils.BaseUI):
|
|||||||
#======================================= CONNECTION =====================================
|
#======================================= CONNECTION =====================================
|
||||||
def create_connections(self):
|
def create_connections(self):
|
||||||
"""
|
"""
|
||||||
连接信号和槽
|
创建绑定系统UI信号和槽连接
|
||||||
设置UI控件的交互行为
|
将按钮点击等事件与相应的处理函数连接
|
||||||
"""
|
"""
|
||||||
# DNA浏览器按钮连接
|
# 左侧面板 - 骨骼列表操作
|
||||||
self.buttons["refresh_dna"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
self.buttons["add_joint"].clicked.connect(self.add_joint)
|
||||||
|
self.buttons["remove_joint"].clicked.connect(self.remove_joint)
|
||||||
|
self.buttons["duplicate_joint"].clicked.connect(self.duplicate_joint)
|
||||||
|
self.controls["skeleton_list"].itemSelectionChanged.connect(self.on_joint_selection_changed)
|
||||||
|
|
||||||
# DNA操作按钮连接
|
# 左侧面板 - 控制器列表操作
|
||||||
self.buttons["import_skeleton"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
self.buttons["add_controller"].clicked.connect(self.add_controller)
|
||||||
self.buttons["generate_body"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
self.buttons["remove_controller"].clicked.connect(self.remove_controller)
|
||||||
self.buttons["calibrate_dna"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
self.buttons["duplicate_controller"].clicked.connect(self.duplicate_controller)
|
||||||
|
self.controls["controller_list"].itemSelectionChanged.connect(self.on_controller_selection_changed)
|
||||||
|
|
||||||
# 骨骼操作按钮连接
|
# 右侧面板 - 关节属性
|
||||||
self.buttons["calibrate_skeleton"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
self.buttons["apply_joint_properties"].clicked.connect(self.apply_joint_properties)
|
||||||
self.buttons["create_binding"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
self.buttons["reset_joint_properties"].clicked.connect(self.reset_joint_properties)
|
||||||
self.buttons["copy_skin"].clicked.connect(utils_rigging.rigging_temp_utils_function)
|
|
||||||
|
# 坐标输入框修改事件
|
||||||
|
self.controls["joint_name_input"].textChanged.connect(self.on_joint_name_changed)
|
||||||
|
self.controls["joint_x_input"].textChanged.connect(lambda: self.on_joint_position_changed("x"))
|
||||||
|
self.controls["joint_y_input"].textChanged.connect(lambda: self.on_joint_position_changed("y"))
|
||||||
|
self.controls["joint_z_input"].textChanged.connect(lambda: self.on_joint_position_changed("z"))
|
||||||
|
self.controls["joint_rx_input"].textChanged.connect(lambda: self.on_joint_rotation_changed("x"))
|
||||||
|
self.controls["joint_ry_input"].textChanged.connect(lambda: self.on_joint_rotation_changed("y"))
|
||||||
|
self.controls["joint_rz_input"].textChanged.connect(lambda: self.on_joint_rotation_changed("z"))
|
||||||
|
self.controls["joint_sx_input"].textChanged.connect(lambda: self.on_joint_scale_changed("x"))
|
||||||
|
self.controls["joint_sy_input"].textChanged.connect(lambda: self.on_joint_scale_changed("y"))
|
||||||
|
self.controls["joint_sz_input"].textChanged.connect(lambda: self.on_joint_scale_changed("z"))
|
||||||
|
|
||||||
|
# 右侧面板 - 绑定工具
|
||||||
|
self.buttons["create_binding"].clicked.connect(self.create_binding)
|
||||||
|
self.buttons["copy_skin"].clicked.connect(self.copy_skin)
|
||||||
|
self.buttons["mirror_skin"].clicked.connect(self.mirror_skin)
|
||||||
|
self.buttons["paint_weights"].clicked.connect(self.paint_weights)
|
||||||
|
|
||||||
|
# 底部工具面板 - DNA操作
|
||||||
|
self.buttons["import_dna"].clicked.connect(self.import_dna)
|
||||||
|
self.buttons["export_dna"].clicked.connect(self.export_dna)
|
||||||
|
self.buttons["calibrate_dna"].clicked.connect(self.calibrate_dna)
|
||||||
|
|
||||||
|
# 底部工具面板 - 骨骼工具
|
||||||
|
self.buttons["import_skeleton"].clicked.connect(self.import_skeleton)
|
||||||
|
self.buttons["export_skeleton"].clicked.connect(self.export_skeleton)
|
||||||
|
self.buttons["calibrate_skeleton"].clicked.connect(self.calibrate_skeleton)
|
||||||
|
|
||||||
|
# 底部工具面板 - 绑定工具
|
||||||
|
self.buttons["generate_controllers"].clicked.connect(self.generate_controllers)
|
||||||
|
self.buttons["generate_body"].clicked.connect(self.generate_body)
|
||||||
|
self.buttons["clean_rigging"].clicked.connect(self.clean_rigging)
|
||||||
|
|
||||||
|
# 分割器移动事件
|
||||||
|
self.splitters["main_splitter"].splitterMoved.connect(self.on_splitter_moved)
|
||||||
|
|
||||||
|
# 添加显示事件处理
|
||||||
|
self.showEvent = self.on_show_event
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user