Skip to content

Commit dba1fb4

Browse files
committed
improve the input parameters for scale
1 parent ea54273 commit dba1fb4

10 files changed

Lines changed: 348 additions & 14 deletions

File tree

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@ __pycache__
22
unity_animation_player/__pycache__
33
test*.py
44
examples/AnimationClip/*
5-
!examples/AnimationClip/T.anim
5+
!examples/AnimationClip/T.anim
6+
PREVIOUS
7+
*.drawio
8+
*.svg
9+
展板.png
10+
constant_test

contrast_noweight.png

65.3 KB
Loading

examples/AnimationClip/T.anim

Lines changed: 327 additions & 2 deletions
Large diffs are not rendered by default.

examples/interactive_panel_example.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from dataclasses import asdict
55
from PySide6.QtWidgets import (
66
QApplication, QWidget, QVBoxLayout, QHBoxLayout,
7-
QLabel, QComboBox, QFrame, QCheckBox, QDoubleSpinBox, QPushButton
7+
QLabel, QComboBox, QFrame, QCheckBox, QDoubleSpinBox, QPushButton, QTextEdit
88
)
9+
from PySide6.QtGui import QFont
910
from PySide6.QtCore import Qt
1011

1112
import pyqtgraph as pg
@@ -177,8 +178,10 @@ def setup_ui(self):
177178
self.overall_layout = QVBoxLayout()
178179

179180
self.head_layout = QHBoxLayout()
180-
self.kwargs_label = QLabel()
181-
self.head_layout.addWidget(self.kwargs_label)
181+
self.kwargs_lines = QTextEdit()
182+
self.kwargs_lines.setReadOnly(True)
183+
self.kwargs_lines.setFixedHeight(self.kwargs_lines.fontMetrics().lineSpacing() * 2 + 14)
184+
self.head_layout.addWidget(self.kwargs_lines)
182185

183186
self.overall_layout.addLayout(self.head_layout)
184187

@@ -730,7 +733,7 @@ def on_ball_window_button_pressed(self, button_name):
730733
def update_graph(self):
731734
if not self.play_kwargs.path: return
732735

733-
self.kwargs_label.setText(', '.join((f'''{key}={round(value, 3) if type(value) == float
736+
self.kwargs_lines.setText(', '.join((f'''{key}={round(value, 3) if type(value) == float
734737
else '"'+value+'"' if type(value) == str
735738
else value}'''
736739
for key, value in asdict(self.play_kwargs).items()
@@ -780,6 +783,7 @@ def main():
780783
with open(Path(__file__).parent / 'style.qss', 'r', encoding='utf-8') as f:
781784
app.setStyleSheet(f.read())
782785
app.setStyleSheet(qdarkstyle.load_stylesheet_pyside6())
786+
app.setFont(QFont('Consolas', 10))
783787

784788
interactive_panel = InteractivePanel(screen_size=screen.size().toTuple())
785789
interactive_panel.show()

examples/qml_window_example_windows/ball_window.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ def __init__(self) -> None:
9191
self.setup_multiple_animations(self.animated_buttons)
9292

9393
self.ball_animation_signal.connect(self.on_ball_signal_received)
94-
self.ball_animation_player = PysideAnimationPlayer(self.ball_animation_signal, "examples/AnimationClip/T.anim", stop_time=None, position_ratio=(9, 4))
94+
self.ball_animation_player = PysideAnimationPlayer(self.ball_animation_signal, "examples/AnimationClip/Hihumi_Original_TSS_Interaction01.anim", stop_time=None, position_ratio=(-24000, -6000), path="bone_root/Bip001")
95+
#self.ball_animation_player = PysideAnimationPlayer(self.ball_animation_signal, "examples/AnimationClip/T.anim", stop_time=None, position_ratio=(9, 4))
9596

96-
pos_points = [point['position'] for point in self.ball_animation_player.sample_range(0.001).values()]
97-
#self.graph_widget.update_plot(pos_points)#
9897
self.play_anim()
9998

10099
def setup_multiple_animations(self, button_names):

matplotlib_noweight.PNG

48.3 KB
Loading

run_example.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python example.py

unity_animation_player/animation_player.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _get_seg_result(self, segments: Any, t: float) -> float:
152152
return segments[-1](t) # Boundary case
153153

154154
def return_default(self,
155-
default_value: float = 0.0,
155+
default_value: float = 0.0, default_scale=1.0,
156156
**kwargs: Union[str, bool, Tuple, float]) -> Tuple[Dict[str, Any], bool]:
157157

158158
typed_kwargs = type_kwargs(**kwargs)
@@ -177,9 +177,9 @@ def return_default(self,
177177
if 'Scale' in ani:
178178
scale_unit = typed_kwargs['scale_unit']
179179
if isinstance(scale_unit, tuple):
180-
dic['scale'] = tuple(default_value for _ in scale_unit)
180+
dic['scale'] = tuple(default_scale for _ in scale_unit)
181181
else:
182-
dic['scale'] = default_value
182+
dic['scale'] = default_scale
183183

184184
if 'Float' in ani:
185185
dic['float'] = default_value

unity_noweight.PNG

20.5 KB
Loading

visualization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
def main():
1111
# 1. Input animation file path
1212
#anim_path = input("Enter animation file path (e.g., examples/AnimationClip/UIAni_SC_Char_Shake_3.anim): ").strip()
13-
anim_path = "examples/AnimationClip/T.anim"
13+
anim_path = "examples/AnimationClip/T_noweight.anim"
1414

1515
try:
1616
player = AnimationPlayer(anim_path)

0 commit comments

Comments
 (0)