1.修改属性面板横向显示内容
2.修改非骨骼动画属性面板
This commit is contained in:
parent
eb3ce79c17
commit
f1cbd3ffea
@ -21,6 +21,19 @@ class PropertyPanelManager:
|
||||
self._propertyLayout = None
|
||||
self._actor_cache={}
|
||||
|
||||
# 定义紧凑样式
|
||||
self.compact_style = """
|
||||
QDoubleSpinBox {
|
||||
min-width: 45px;
|
||||
}
|
||||
QPushButton {
|
||||
min-width: 10px;
|
||||
}
|
||||
QComboBox {
|
||||
min-width: 50px;
|
||||
}
|
||||
"""
|
||||
|
||||
def setPropertyLayout(self, layout):
|
||||
"""设置属性面板布局引用"""
|
||||
print("开始设置属性布局")
|
||||
@ -58,6 +71,10 @@ class PropertyPanelManager:
|
||||
|
||||
self.clearPropertyPanel()
|
||||
|
||||
# 应用紧凑样式到属性面板容器
|
||||
if self._propertyLayout.parent():
|
||||
self._propertyLayout.parent().setStyleSheet(self.compact_style)
|
||||
|
||||
itemText = item.text(0)
|
||||
|
||||
# 如果点击的是场景根节点,显示提示信息
|
||||
@ -4939,18 +4956,20 @@ except Exception as e:
|
||||
# 如果有多种类型的动画,使用标签页
|
||||
if len(animations) > 1:
|
||||
tab_widget = QTabWidget()
|
||||
tab_widget.setMinimumWidth(200) # 设置最小宽度
|
||||
|
||||
for anim_type, anim_data in animations.items():
|
||||
tab = QWidget()
|
||||
tab_layout = QVBoxLayout(tab)
|
||||
tab_layout = QGridLayout(tab) # 改为QGridLayout保持一致
|
||||
self._buildAnimationTypeUI(tab_layout, origin_model, anim_type, anim_data)
|
||||
tab_widget.addTab(tab, self._getAnimTypeDisplayName(anim_type))
|
||||
|
||||
self._propertyLayout.addRow("动画类型:", tab_widget)
|
||||
layout.addWidget(QLabel("动画类型:"), 1, 0)
|
||||
layout.addWidget(tab_widget, 1, 1, 1, 3)
|
||||
else:
|
||||
# 只有一种类型,直接显示
|
||||
anim_type, anim_data = next(iter(animations.items()))
|
||||
self._buildAnimationTypeUI(self._propertyLayout, origin_model, anim_type, anim_data)
|
||||
self._buildAnimationTypeUI(layout, origin_model, anim_type, anim_data)
|
||||
|
||||
# 存储动画信息供控制使用
|
||||
if not hasattr(self, '_non_skeletal_cache'):
|
||||
@ -4961,46 +4980,69 @@ except Exception as e:
|
||||
"""为特定动画类型构建UI"""
|
||||
from PyQt5.QtWidgets import QLabel, QComboBox, QHBoxLayout, QWidget, QPushButton, QDoubleSpinBox
|
||||
|
||||
current_row = layout.rowCount()
|
||||
|
||||
if anim_type == 'transform':
|
||||
# 变换动画控制
|
||||
self.ns_transform_combo = QComboBox()
|
||||
self.ns_transform_combo.addItems(anim_data['names'])
|
||||
layout.addRow("变换动画:", self.ns_transform_combo)
|
||||
self.ns_transform_combo.setMinimumWidth(80)
|
||||
layout.addWidget(QLabel("变换动画:"), current_row, 0)
|
||||
layout.addWidget(self.ns_transform_combo, current_row, 1, 1, 3)
|
||||
current_row += 1
|
||||
|
||||
elif anim_type == 'texture':
|
||||
# 纹理动画控制
|
||||
self.ns_texture_combo = QComboBox()
|
||||
self.ns_texture_combo.addItems(anim_data['stages'])
|
||||
layout.addRow("纹理动画:", self.ns_texture_combo)
|
||||
self.ns_texture_combo.setMinimumWidth(80)
|
||||
layout.addWidget(QLabel("纹理动画:"), current_row, 0)
|
||||
layout.addWidget(self.ns_texture_combo, current_row, 1, 1, 3)
|
||||
current_row += 1
|
||||
|
||||
elif anim_type == 'material':
|
||||
# 材质动画控制
|
||||
self.ns_material_combo = QComboBox()
|
||||
self.ns_material_combo.addItems(anim_data['properties'])
|
||||
layout.addRow("材质动画:", self.ns_material_combo)
|
||||
self.ns_material_combo.setMinimumWidth(80)
|
||||
layout.addWidget(QLabel("材质动画:"), current_row, 0)
|
||||
layout.addWidget(self.ns_material_combo, current_row, 1, 1, 3)
|
||||
current_row += 1
|
||||
|
||||
elif anim_type == 'lerp':
|
||||
# Lerp动画控制
|
||||
self.ns_lerp_combo = QComboBox()
|
||||
self.ns_lerp_combo.addItems(anim_data['intervals'])
|
||||
layout.addRow("Lerp动画:", self.ns_lerp_combo)
|
||||
self.ns_lerp_combo.setMinimumWidth(80)
|
||||
layout.addWidget(QLabel("Lerp动画:"), current_row, 0)
|
||||
layout.addWidget(self.ns_lerp_combo, current_row, 1, 1, 3)
|
||||
current_row += 1
|
||||
|
||||
# 通用控制按钮
|
||||
btn_box = QWidget()
|
||||
btn_lay = QHBoxLayout(btn_box)
|
||||
btn_lay.setContentsMargins(0, 0, 0, 0)
|
||||
for txt, cmd in (("播放", "play"), ("暂停", "pause"), ("停止", "stop"), ("循环", "loop")):
|
||||
btn = QPushButton(txt)
|
||||
btn.setMinimumWidth(35) # 设置按钮最小宽度
|
||||
btn.setMaximumWidth(50) # 限制按钮最大宽度
|
||||
btn.clicked.connect(lambda _, c=cmd, t=anim_type: self._controlNonSkeletalAnimation(origin_model, t, c))
|
||||
btn_lay.addWidget(btn)
|
||||
layout.addRow("控制:", btn_box)
|
||||
layout.addWidget(QLabel("控制:"), current_row, 0)
|
||||
layout.addWidget(btn_box, current_row, 1, 1, 3)
|
||||
current_row += 1
|
||||
|
||||
# 播放速度
|
||||
speed_spinbox = QDoubleSpinBox()
|
||||
speed_spinbox.setRange(0.1, 5.0)
|
||||
speed_spinbox.setSingleStep(0.1)
|
||||
speed_spinbox.setValue(1.0)
|
||||
speed_spinbox.valueChanged.connect(lambda v, t=anim_type: self._setNonSkeletalAnimationSpeed(origin_model, t, v))
|
||||
layout.addRow("播放速度:", speed_spinbox)
|
||||
speed_spinbox.setMinimumWidth(60)
|
||||
speed_spinbox.setMaximumWidth(80)
|
||||
speed_spinbox.valueChanged.connect(
|
||||
lambda v, t=anim_type: self._setNonSkeletalAnimationSpeed(origin_model, t, v))
|
||||
layout.addWidget(QLabel("播放速度:"), current_row, 0)
|
||||
layout.addWidget(speed_spinbox, current_row, 1, 1, 3)
|
||||
|
||||
def _getAnimTypeDisplayName(self, anim_type):
|
||||
"""获取动画类型的显示名称"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user