Skip to content

Commit 8bd6109

Browse files
author
arch
committed
refactor config
1 parent 08d5bd0 commit 8bd6109

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class FunscriptGeneratorParameter:
4949
# General
5050
skip_frames: int = max((0, int(HYPERPARAMETER['skip_frames'])))
5151

52-
# y-Movement
52+
# y VR Movement
5353
shift_bottom_points: int = int(HYPERPARAMETER['shift_bottom_points'])
5454
shift_top_points: int = int(HYPERPARAMETER['shift_top_points'])
5555
bottom_points_offset: float = float(HYPERPARAMETER['bottom_points_offset'])
@@ -58,12 +58,12 @@ class FunscriptGeneratorParameter:
5858
top_threshold: float = float(HYPERPARAMETER['top_threshold'])
5959

6060
# x-Movement
61-
shift_left_points: int = int(HYPERPARAMETER['shift_left_points'])
62-
shift_right_points: int = int(HYPERPARAMETER['shift_right_points'])
63-
left_points_offset: float = float(HYPERPARAMETER['left_points_offset'])
64-
right_points_offset: float = float(HYPERPARAMETER['right_points_offset'])
65-
left_threshold: float = float(HYPERPARAMETER['left_threshold'])
66-
right_threshold: float = float(HYPERPARAMETER['right_threshold'])
61+
shift_min_points: int = int(HYPERPARAMETER['shift_min_points'])
62+
shift_max_points: int = int(HYPERPARAMETER['shift_max_points'])
63+
min_points_offset: float = float(HYPERPARAMETER['min_points_offset'])
64+
max_points_offset: float = float(HYPERPARAMETER['max_points_offset'])
65+
min_threshold: float = float(HYPERPARAMETER['min_threshold'])
66+
max_threshold: float = float(HYPERPARAMETER['max_threshold'])
6767

6868

6969
class FunscriptGeneratorThread(QtCore.QThread):
@@ -331,7 +331,7 @@ def calculate_score(self) -> None:
331331
# this should never happen
332332
self.logger.error('Calculate score not implement for x=%d, y=%d', x, y)
333333

334-
# invert
334+
# invert because math angle is ccw
335335
self.score['pitch'] = [-1.0*item for item in self.score['pitch']]
336336

337337

@@ -799,8 +799,8 @@ def apply_shift(self, frame_number: int, metric: str, position: str) -> int:
799799
Returns:
800800
int: real frame position
801801
"""
802-
shift_max = self.params.shift_top_points if metric == 'y' else self.params.shift_right_points
803-
shift_min = self.params.shift_bottom_points if metric == 'y' else self.params.shift_left_points
802+
shift_max = self.params.shift_top_points if metric == 'y' else self.params.shift_max_points
803+
shift_min = self.params.shift_bottom_points if metric == 'y' else self.params.shift_min_points
804804

805805
if position in ['max'] :
806806
if frame_number >= -1*shift_max \
@@ -825,8 +825,8 @@ def get_score_with_offset(self, idx_dict: dict, metric: str) -> list:
825825
Returns:
826826
list: score with offset
827827
"""
828-
offset_max = self.params.top_points_offset if metric == 'y' else self.params.right_points_offset
829-
offset_min = self.params.bottom_points_offset if metric == 'y' else self.params.left_points_offset
828+
offset_max = self.params.top_points_offset if metric == 'y' else self.params.max_points_offset
829+
offset_min = self.params.bottom_points_offset if metric == 'y' else self.params.min_points_offset
830830

831831
score = copy.deepcopy(self.score[metric])
832832
score_min, score_max = min(score), max(score)
@@ -895,8 +895,8 @@ def create_funscript(self, idx_dict: dict) -> None:
895895
else:
896896
output_score = self.get_score_with_offset(idx_dict, self.params.metric)
897897

898-
threshold_min = self.params.bottom_threshold if self.params.metric == 'y' else self.params.left_threshold
899-
threshold_max = self.params.top_threshold if self.params.metric == 'y' else self.params.right_threshold
898+
threshold_min = self.params.bottom_threshold if self.params.metric == 'y' else self.params.min_threshold
899+
threshold_max = self.params.top_threshold if self.params.metric == 'y' else self.params.max_threshold
900900

901901
for idx in idx_dict['min']:
902902
self.funscript.add_action(

funscript_editor/config/hyperparameter.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ local_min_delta_in_percent: 0.25
2424
min_frames: 100
2525

2626

27-
##############
28-
# y-Movement #
29-
##############
27+
##############################
28+
# VR Movement in y Direction #
29+
##############################
3030

3131
# Shift predicted top points by given frame number. Positive values delay the position
3232
# and negative values result in an earlier position.
@@ -53,30 +53,30 @@ top_threshold: 2.5
5353
bottom_threshold: 2.5
5454

5555

56-
##############
57-
# x-Movement #
58-
##############
56+
#################################
57+
# All other predicted Movements #
58+
#################################
5959

60-
# Shift predicted left points by given frame number. Positive values delay the position
60+
# Shift predicted min points by given frame number. Positive values delay the position
6161
# and negative values result in an earlier position.
62-
shift_left_points: 0
62+
shift_min_points: 0
6363

64-
# Shift predicted right points by given frame number. Positive values delay the position
64+
# Shift predicted max points by given frame number. Positive values delay the position
6565
# and negative values result in an earlier position.
66-
shift_right_points: 0
66+
shift_max_points: 0
6767

68-
# An fix offset to the left points (positive values move the point right and negative values
69-
# move the point left). The offset respect the user defined upper and lower limit.
70-
left_points_offset: -7.5
68+
# An fix offset to the min points (positive values increase position and negative values
69+
# lower the points). The offset respect the user defined upper and lower limit.
70+
min_points_offset: -7.5
7171

72-
# An fix offset to the right points (positive values move the point right and negative values
73-
# move the point left). The offset respect the user defined upper and lower limit.
74-
right_points_offset: 7.5
72+
# An fix offset to the max points (positive values increase the position and negative values
73+
# lower the points). The offset respect the user defined upper and lower limit.
74+
max_points_offset: 7.5
7575

76-
# Define the left threshold. All left points lower than (min + threshold) will be set to
76+
# Define the min threshold. All min points lower than (min + threshold) will be set to
7777
# the specified min value. Set 0.0 to disable this function.
78-
left_threshold: 2.5
78+
min_threshold: 2.5
7979

80-
# Define the right threshold. All right points greater than (max - threshold) will be set to
80+
# Define the max threshold. All right points greater than (max - threshold) will be set to
8181
# the specified max value. Set 0.0 to disable this function.
82-
right_threshold: 2.5
82+
max_threshold: 2.5

funscript_editor/ui/settings_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __setup_ui_bindings(self):
4343

4444
def __setup_combo_boxes(self):
4545
self.ui.videoTypeComboBox.addItems([PROJECTION[key]['name'] for key in PROJECTION.keys()])
46-
self.ui.trackingMetricComboBox.addItems(['y', 'x', 'euclideanDistance'])
46+
self.ui.trackingMetricComboBox.addItems(['y', 'x', 'euclideanDistance', 'pitch'])
4747
self.ui.trackingMethodComboBox.addItems(['Woman', 'Woman + Men'])
4848

4949
def __set_tracking_metric(self, value):

0 commit comments

Comments
 (0)